On 1/25/06, Toby Dickenson <tdickenson@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