PEP on path module for standard library

John Machin sjmachin at lexicon.net
Fri Jul 22 17:05:05 EDT 2005


Daniel Dittmar wrote:
> Duncan Booth wrote:
> 
>>  I would have expected a path object to be a sequence of path elements 
>> rather than a sequence of characters. 
> 
> 
> 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.

Try this:

A file-system is a maze of twisty little passages, all alike. Junction 
== directory. Cul-de-sac == file. Fortunately it is signposted. You are 
dropped off at one of the entrance points ("current directory", say). 
You are given a route (a "path") to your destination. The route consists 
of a list of intermediate destinations.

for element in pathobject:
    follow_sign_post_to(element)

Exception-handling strategy: Don't forget to pack a big ball of string. 
Anecdotal evidence is that breadcrumbs are unreliable.

Cheers,
John



More information about the Python-list mailing list