[path-PEP] Path inherits from basestring again
Michael Hoffman
cam.ac.uk at mh391.invalid
Sun Jul 24 09:14:49 EDT 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__[0](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.
--
Michael Hoffman
More information about the Python-list
mailing list