This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients eric.araujo, fruch, terry.reedy
Date 2012-02-04.09:48:52
SpamBayes Score 9.833617e-11
Marked as misclassified No
Message-id <1328348933.98.0.181099412603.issue13929@psf.upfronthosting.co.za>
In-reply-to
Content
If indeed fnmatch does not match current shells, then I would agree that it should. It looks to me so easy to add that I though it must be a deliberate decision to exclude. In translate:
...
        elif c == '\':
            if i < n-1:
                c2 = pat[i+1]
                <specify what to do for \c2 for all cases of c2>
            else:
                <specify what to do for pattern ending in '\'>
        else:  
            res = res + re.escape(c)
# the last two lines are current code, which is why '\' in patterns does not escape anything in the translated re.

Changing the meaning of '\' from ordinary character to escape char will break any code that depends on its current ordinariness.
>>> fn.fnmatch(r'\x', r'\?')
True # for x any 'ordinary' char, but not is '\?' means "match '?'.

This was another reason I closed, although I forgot to mention it. I suppose a new parameter 'escape = False' could be added to all 4 exposed functions to preserve back compatibility. Anyway, I have reopened for further discussion and specification.
History
Date User Action Args
2012-02-04 09:48:54terry.reedysetrecipients: + terry.reedy, eric.araujo, fruch
2012-02-04 09:48:53terry.reedysetmessageid: <1328348933.98.0.181099412603.issue13929@psf.upfronthosting.co.za>
2012-02-04 09:48:53terry.reedylinkissue13929 messages
2012-02-04 09:48:52terry.reedycreate