[path-PEP] Path inherits from basestring again

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Mon Jul 25 12:43:41 EDT 2005


skip at pobox.com wrote:
>     Reinhold> Right, that was a concern of mine, too.
>     Reinhold> "tobase"?
>     Reinhold> "tostring"?
>     Reinhold> "tobasestring"?
> 
> If we're on a filesystem that understands unicode, would somepath.tostring()
> return a unicode object or a string object encoded with some
> to-be-determined encoding?

Whatever the base of the Path object is. It selects its base class based on
os.path.supports_unicode_filenames.

> Why not just add __str__ and __unicode__ methods to the class and let the
> user use str(somepath) or unicode(somepath) as needed?
> 
> Or am I missing something fundamental about what the base() method is
> supposed to do?

It should provide an alternative way of spelling Path.__bases__[0](path).

Reinhold



More information about the Python-list mailing list