PEP on path module for standard library
Stefan Rank
stefan.rank at ofai.at
Fri Jul 22 11:01:53 EDT 2005
on 22.07.2005 16:14 George Sakkis said the following:
> "Duncan Booth" <duncan.booth at invalid.invalid> 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.
>>
[snip]
> practicality-vs-purity decision. You're right, conceptually a path
> HAS_A string description, not IS_A string, so from a pure OO point of
> view, it should not inherit string.
Java has `File` which mixes the concepts "an object in the filesystem"
and "a structured locator for such objects (in a hierarchical fs) that
might or might not correspond to an object that is actually there".
`file` and `path` separate that. I think this is very reasonable.
(It would be nice to get `path`(s) easily from a `file`, at the moment
there is only file.name if I'm not mistaken).
And a `path`, to me, actually IS_A string (unicode string) that happens
to have special behaviour (such as os dependent quirks like a
pathseparator that automatically get translated, comparable to '\n' used
internally in strings translated to '\n'|'\r\n')
stefan
More information about the Python-list
mailing list