Terry J. Reedy <tjre...@udel.edu> added the comment:

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.

----------
resolution: rejected -> 
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to