Hack with os.walk()

Fernando Perez fperez.net at gmail.com
Sat Feb 12 17:52:09 EST 2005


Michael Spencer wrote:

> The path module by Jorendorff: http://www.jorendorff.com/articles/python/path/
> 
> wraps various os functions into an interface that can make this sort of thing
> cleaner

Wow, many thanks for the pointer.  This has to be one of the single most useful
small python modules out there, and it seems to address (from reading the docs)
most of the things that annoy the hell out of me when doing filesystem
scripting in python.

I've always felt that filesystem-related scripting, in python, is unnecessarily
complicated.  It is perhaps the only part of the stdlib (note: I don't claim to
have used it all) which positively, unfailingly, manages to piss me off every
time I use it.

The main problem is that things which are conceptually related, are scattered
all over the stdlib.  Do you know, off the top of your head, whether a
file-related function is in os, os.path, shutil, glob, dircache, etc?  I've
actually considered writing a PEP requesting this, but such an effort would
obviously mean writing an implementation.  Not hard, but I just don't have the
time for it.

Perhaps this path.py could be considered for inclusion in the stdlib?  I've only
read the page linked above, so perhaps it can use some polishing.  But it
certainly looks like a big improvement over the scatterblast which the stdlib
is on this particular topic.

Best,

f




More information about the Python-list mailing list