[path-PEP] Path inherits from basestring again

Ivan Van Laningham ivanlan at pauahtun.org
Sun Jul 24 09:30:02 EDT 2005


Hi All--

Reinhold Birkenfeld wrote:
> 
> Reinhold Birkenfeld wrote:
> > Hi,
> >
> > the arguments in the previous thread were convincing enough, so I made the
> > Path class inherit from str/unicode again.
> 

Thanks.

> * the following methods raise NotImplemented:
>   capitalize, expandtabs, join, splitlines, title, zfill
> 

If path inherits from str or unicode, why not leave these?  I can
certainly see uses for capitalize(), title() and zfill() when trying to
coerce Windows to let me use the case that I put there in the first
place;-)  What if I wanted to take a (legitimate) directory name
'parking\tlot' and change it to 'parking        lot'?

> Open issues:
> 
> What about the is* string methods?

What about them?  What makes you think these wouldn't be useful? 
Imagine directory names made up of all numbers; wouldn't it be useful to
know which directories in a tree of, say, digital camera images,
comprise all numbers, all hex numbers, or alpha only?
> 
> What about __contains__ and __getitem__?

I find it hard to imagine what would be returned when asking a path for
say, path["c:"], other than the index. n=path["c:"] = 0 ? 
> 
> What about path * 4?

This one makes my brain hurt, I admit;-)


Metta,
Ivan
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



More information about the Python-list mailing list