PEP on path module for standard library
Daniel Dittmar
daniel.dittmar at sap.corp
Mon Jul 25 04:54:53 EDT 2005
John Roth wrote:
> However, a path as a sequence of characters has even less
> meaning - I can't think of a use, while I have an application
That's true. But the arguments for path objects as strings go more in
the direction of using existing functions that expect strings.
> where traversing a path as a sequence of path elements makes
> perfect sense: I need to descend the directory structure, directory
> by directory, looking for specific files and types.
But then your loop doesn't need the individual path elements, but rather
sub-path objects
for p in pathobj.stepdown ('/usr/local/bin'):
if p.join (searchedFile):
whatever
I'm not saying that there isn't any use for having a list of path
elements. But it isn't that common, so it should get an methodname to
make it more explicit.
Daniel
More information about the Python-list
mailing list