[Python-Dev] The path module PEP

Ian Bicking ianb at colorstudy.com
Wed Jan 25 22:03:44 CET 2006


BJörn Lindqvist wrote:
> * match() and matchcase() wraps the fnmatch.fnmatch() and
>   fnmatch.fnmatchcase() functions. I believe that the renaming is
>   uncontroversial and that the introduction of matchcase() makes it so
>   the whole fnmatch module can be deprecated.

The renaming is fine with me.  I generally use the fnmatch module for 
wildcard matching, not necessarily against path names.  Path.match 
doesn't replace that functionality.  Though fnmatch.translate isn't even 
publically documented, which is the function I actually tend to use.

Though it seems a little confusing to me that glob treats separators 
specially, and that's not implemented at the fnmatch level.  So 
Path('/a/b/d/c').match('a/*/d') is true, but Path('/').walk('a/*/d') 
won't return Path('/a/b/c/d').  I think .match() should be fixed.  But I 
don't think fnmatch should be changed.

I'm actually finding myself a little confused by the glob arguments (if 
the glob contains '/'), now that I really think about them.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Python-Dev mailing list