PEP on path module for standard library

Peter Hansen peter at engcorp.com
Fri Jul 22 09:06:41 EDT 2005


Duncan Booth wrote:
> Personally I think the concept of a specific path type is a good one, but 
> subclassing string just cries out to me as the wrong thing to do. In other 
> words, to me a path represents something in a filesystem, the fact that it 
> has one, or indeed several string representations does not mean that the 
> path itself is simply a more specific type of string.
> 
> You should need an explicit call to convert a path to a string and that 
> forces you when passing the path to something that requires a string to 
> think whether you wanted the string relative, absolute, UNC, uri etc.

Duncan, are you another formerly non-user of path who has this opinion, 
or have you already attempted to use path extensively in your code?

I'm not saying I dismiss the opinions of those who haven't actually 
tried working with a string-based path object, but it's worth 
considering that you might adopt a different opinion after using it for 
a while.

I did.

-Peter



More information about the Python-list mailing list