[path-PEP] Path inherits from basestring again
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Mon Jul 25 12:05:49 EDT 2005
Peter Hansen wrote:
> Reinhold Birkenfeld wrote:
> > Peter Hansen wrote:
> >> Would basestring() be a better name?
>
> > "tobase"?
> > "tostring"?
> > "tobasestring"?
>
> Of these choices, the latter would be preferable.
>
> > Alternative is to set a class attribute "Base" of the
> > Path class. Or export PathBase as a name from the module
> > (but that's not quite useful, because I
> > expect Path to be imported via "from os.path import Path").
>
> I don't understand how that would work. An attribute on the *class*?
> What would it be, a callable? So mypath.Base(mypath) or something?
> Please elaborate...
[_base is str or unicode]
class Path:
Base = _base
[...]
So you could do "Path.Base(mypath)" or "mypath.Base(mypath)".
> What about just .basestring, as a read-only attribute on the Path object?
Reasonable, though the term as such is preoccupied too.
Reinhold
More information about the Python-list
mailing list