PRE-PEP: new Path class

Just just at xs4all.nl
Mon Jan 5 19:01:05 CET 2004


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

> > > 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.
> 
> I see what you're saying. I'd argue (softly) that iterating over
> the directory entries is the natural interpretation, though.

It's far too implicit to my taste; for one since it's a folder-only 
operation (and I don't see much merit in having separate classes for 
folder and file paths). Would you also be in favor of interating over 
file-paths meaning iterating over the lines in the file?

Just



More information about the Python-list mailing list