[docs] glob returns empty list with "[" character in the folder name (issue 8402)

ezio.melotti at gmail.com ezio.melotti at gmail.com
Mon Oct 15 11:21:38 CEST 2012


http://bugs.python.org/review/8402/diff/6281/Doc/library/fnmatch.rst
File Doc/library/fnmatch.rst (right):

http://bugs.python.org/review/8402/diff/6281/Doc/library/fnmatch.rst#newcode76
Doc/library/fnmatch.rst:76: arbitrary literal string that may have
special characters in it.
This could mention what the special characters are.

http://bugs.python.org/review/8402/diff/6281/Doc/library/fnmatch.rst#newcode86
Doc/library/fnmatch.rst:86: True
I'm not sure that showing the output is useful.  The *-[[] seems a bit
confusing if you don't know how escaping works.
If you want to show it, it might be better to escape a pattern that
contains '?'.

http://bugs.python.org/review/8402/diff/6281/Lib/fnmatch.py
File Lib/fnmatch.py (right):

http://bugs.python.org/review/8402/diff/6281/Lib/fnmatch.py#newcode82
Lib/fnmatch.py:82: _magic_check_bytes = re.compile(b'([*?[])')
I would put these two before the function definition, adding a comment
that explains that escaping is done by wrapping any of *?[ between
square brackets.

http://bugs.python.org/review/8402/diff/6281/Lib/test/test_fnmatch.py
File Lib/test/test_fnmatch.py (right):

http://bugs.python.org/review/8402/diff/6281/Lib/test/test_fnmatch.py#newcode53
Lib/test/test_fnmatch.py:53: check('abc', escape('a*'), False)
I would also check escape() directly, rather than doing it only through
check().  Checking for invalid inputs is a good idea too.

http://bugs.python.org/review/8402/


More information about the docs mailing list