[Python-Dev] The path module PEP

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Wed Jan 25 13:30:06 CET 2006


On Tuesday 24 January 2006 20:22, BJörn Lindqvist wrote:

>     Replacing glob.glob
>     -------------------
> 
>     glob.glob("/lib/*.so")
>     ==>
>     Path("/lib").glob("*.so")

This definition seems confusing because it splits the glob pattern string in 
two ('/lib', and '*.so'). Unless there is an intention to change the behavior 
of the current glob module, why not make the glob method parameterless:

    glob.glob("/lib/*.so")
    ==>
    Path("/lib/*.so").glob()


Possible confusion with the one parameter version:

Does glob matching happen on the first half too? That is, does 
Path('*').glob('*.so') match files in any directory, or only directories 
whose name is an asterisk.

What behavior can I expect from Path('/foo/').glob(bar), where bar is some 
arbitrary string? It could be reasonable to expect that it would only match 
filenames inside the foo directory. However it could also be reasonable to 
expect to use bar=='/etc/*'


-- 
Toby Dickenson


More information about the Python-Dev mailing list