[path-PEP] Path inherits from basestring again
cam.ac.uk at mh391.invalid
Sun Jul 24 15:14:49 CEST 2005
Reinhold Birkenfeld wrote:
> * __iter__() iterates over the parts().
> * the following methods raise NotImplemented:
> capitalize, expandtabs, join, splitlines, title, zfill
Why? They *are* implemented. I do not understand this desire to wantonly
break basestring compatiblity for the sake of breaking compatibility.
Once you break compatibility with basestring you can no longer use a
path anywhere that you could have used a str or unicode before. With
compatibility broken, the only possible supported way of passing paths
to third-party functions will be to cast the path with
path.__bases__(mypath) before passing it anywhere else. You can't
even use str() because you don't know what the base class of the path
is. What a pain.
From the original path.py documentation:
os.path.join doesn't map to path.join(), because there's a string method
with that name. Instead it's path.joinpath(). This is a nuisance, but
changing the semantics of base class methods is worse. (I know, I tried
it.) The same goes for split().
It ain't broke. Please stop breaking it.
More information about the Python-list