diff -r 2d2d4807a3ed Lib/glob.py --- a/Lib/glob.py Sun Dec 16 16:40:22 2012 +0100 +++ b/Lib/glob.py Sun Dec 16 21:10:24 2012 +0200 @@ -57,8 +57,8 @@ names = os.listdir(dirname) except os.error: return [] - if pattern[0] != '.': - names = [x for x in names if x[0] != '.'] + if not _ishidden(pattern): + names = [x for x in names if not _ishidden(x)] return fnmatch.filter(names, pattern) def glob0(dirname, basename): @@ -82,3 +82,6 @@ else: match = magic_check.search(s) return match is not None + +def _ishidden(path): + return path[0] in ('.', b'.'[0])