A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-January/060056.html below:

[Python-Dev] The path module PEP

[Python-Dev] The path module PEPJason Orendorff jason.orendorff at gmail.com
Wed Jan 25 17:12:00 CET 2006
On 1/25/06, Toby Dickenson <tdickenson at devmail.geminidataloggers.co.uk> wrote:
> 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'). [...]

Well, let's make this look more like real code:

    #line 1
    LIB_DIR = "/lib"
    ==>
    LIB_DIR = Path("/lib")

    #line 296
    libs = glob.glob(os.path.join(LIB_DIR, "*.so"))
    ==>
    libs = LIB_DIR.files("*.so")

Clearer?  In d.files(pattern), d is simply the root directory for the
search.  The same is true of all the searching methods: dirs(),
walkfiles(), walkdirs(), etc.

I actually never use path.glob().  For example, here files() is
actually more accurate, and the word "files" is surely clearer than
"glob".  Given files(), dirs(), and listdir(), I have never found a
real use case for glob().

-j
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4