PEP on path module for standard library

Terry Reedy tjreedy at udel.edu
Fri Jul 22 14:11:34 EDT 2005


"Daniel Dittmar" <daniel.dittmar at sap.corp> wrote in message 
news:dbr79q$ftg$1 at news.sap-ag.de...

> Duncan Booth wrote:
>>  I would have expected a
>> path object to be a sequence of path elements rather than a sequence of
>> characters.

Glad I'm not the only oddball.

> Maybe it's nitpicking, but I don't think that a path object should be a
> 'sequence of path elements' in an iterator context.
>
> This means that
>
> for element in pathobject:
>
> has no intuitive meaning for me, so it shouldn't be allowed.

????  The internal equivalent of (simplified, omitting error checking, 
etc.)

for dir in pathobject:
  if isdir(dir): cd(dir)

*is*, in essence, what the OS mainly does with paths (after splitting the 
string representation into pieces).

Directory walks also work with paths as sequences (stacks, in particular).

Terry J. Reedy






More information about the Python-list mailing list