[Python-Dev] The path module PEP
Barry Warsaw
barry at python.org
Thu Jan 26 05:48:52 CET 2006
On Wed, 2006-01-25 at 22:30 -0600, Ian Bicking wrote:
> IMHO the hierarchy problem is a misdesign of strings; iterating over
> strings is usually a bug, not a deliberately used feature. And it's a
> particularly annoying bug, leading to weird results.
Agreed. I've written iteration code that has to special case
basestrings before and that's particularly ugly.
> In this case a Path is not a container for characters. Strings aren't
> containers for characters either -- apparently they are containers for
> smaller strings, which in turn contain themselves. Paths might be seen
> as a container for other subpaths, but I think everyone agrees this is
> too ambigous and implicit. So there's nothing sensible that __iter__
> can do, and having it do something not sensible (just to fill it in with
> something) does not seem very Pythonic.
>
> join is also a funny method that most people wouldn't expect on strings
> anyway. But putting that aside, the real issue I see is that it is a
> miscognate for os.path.join, to which it has no relation. And I can't
> possibly imagine what you'd use it for in the context of a path.
Good points, but to me that argues against having any inheritance
relationship between strings and Paths rather than having such a
relationship and disabling certain methods. Thomas's post seemed more
on-target for me and I'd like to see that idea fleshed out in more
detail. If it's proved to be an impossible (or merely an extremely
infeasible) task, then I think we can discuss the shortcut of deriving
from strings. It just seems gross so I'd like to be sure there's no
better way.
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20060125/ce83f8f2/attachment-0001.pgp
More information about the Python-Dev
mailing list