PEP on path module for standard library

Andrew Dalke dalke at dalkescientific.com
Fri Jul 22 13:23:03 EDT 2005


George Sakkis wrote:
> 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.

How did you decide it's "has-a" vs. "is-a"?

All C calls use a "char *" for filenames and paths,
meaning the C model file for the filesystem says
paths are strings.

Paths as strings fit the Liskov substitution principle
in that any path object can be used any time a
string is used (eg, "loading from " + filename)

Good information hiding suggests that a better API
is one that requires less knowledge.  I haven't
seen an example of how deriving from (unicode)
string makes things more complicated than not doing so.

				Andrew
				dalke at dalkescientific.com




More information about the Python-list mailing list