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
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