PRE-PEP: new Path class

Just just at xs4all.nl
Mon Jan 5 17:32:52 CET 2004


In article <vvivefh35qjv9a at news.supernews.com>,
 "John Roth" <newsgroups at jhrothjr.com> wrote:

> I'm adding a thread for comments on Gerrit Holl's pre-pep, which
> can be found here:
> 
> http://tinyurl.com/2578q
> 
> Frankly, I like the idea. It's about time that all of the file
> and directory stuff in the os module got objectified
> properly (or at least with some semblance of OO propriety!)
> 
> In the issues section:

[ snipping those points where I agree with John ]

> 4) Should path expose an iterator for listdir(?)
> 
> I don't see why not, as long as the path is to a
> directory.

_An_ iterator, sure, but not __iter__. How about path.listdir()? :)
__iter__ could also iterate over the path elements, so it's ambiguous at 
least.

> 15. Should files and directories be the same
> class.
> 
> Probably not. While they share a lot of common
> functionality (which should be spelled out as an
> interface) they also have a lot of dissimilar
> functionality. Separating them also makes it easy
> to create objects for things like symbolic links.

But what about paths for not-yet-existing files of folders? I don't 
think you should actually _hit_ the file system, if all your doing is 
path.join().

Just



More information about the Python-list mailing list