Yes, it matches everything. If you trace through the source code for fnmatch.fnmatch
, it boils down to a regex match on the pattern
In [4]: fnmatch.translate('*')
Out[4]: '.*\\Z(?ms)'
That matches 0-or-more characters followed by the end-of-string (\Z
), with the MULTILINE and DOTALL flags on. That will match any string.
Maybe at some point the line
if fnmatch.fnmatch(path, "*"):
used a more complicated pattern, but was later changed to "*"
instead of omitting the check. But that's just speculation.
In any case, the if-condition
could be removed, since it is always True.