path module

Jason Orendorff jason.orendorff at
Mon Jul 21 20:16:57 CEST 2003

I wrote the 'path' module at:

There was some discussion on it here:

Just a few comments:

Ian and Holger wondered why 'path' should subclass 'str'.  It's because
a path is a string.  Benefit: you can pass 'path' objects to functions
that expect strings (like functions in 'win32file').  I find this
really useful in practice.

I agree with Just that 'path' shouldn't override '__iter__()'.  I'll
change this eventually.

I think Just is the first to argue that 'path / filename' is confusing.
I find it intuitive.  Other people have chosen / for this purpose,
independently:  see the O'Reilly book _Python Cookbook_ [1], recipe 4.17,
and the Boost path object [2].

I do believe 'path' should be in the standard library (if not builtin).
I enjoy it and I use it all the time.  My perception is that the Python
core dev team doesn't see any particular need for it.  If anyone wants me
to, I'll write the PEP.

    for f in path('/music').walkfiles('*.mp3'):



More information about the Python-list mailing list