[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: RE: [path-PEP] Path inherits from basestring again
From: "Meyer, Tony" <T.A.Meyer () massey ! ac ! nz>
Date: 2005-07-27 4:37:45
Message-ID: ECBA357DDED63B4995F5C1F5CBE5B1E801B0F808 () its-xchg4 ! massey ! ac ! nz
[Download RAW message or body]
> > > Do people really like using __div__ to mean join?
> >
> > I think the '+' is used as a join for both strings and lists, so it
> > would probably be the better choice as far as consistency with the
> > language is concerned.
>
> The issue with that is that as long as we are subclassing
> strings, the + is already defined for a useful operation
> and the subclass probably shouldn't be changing the way that works.
But a Path isn't a string, it's string-like. I presume (but am too lazy to check) \
that at the moment using '+' on two Paths gives a Path that concatenates the __str__ \
versions of the Paths, like:
> > > Path("/foo/bar") + Path("/cat/dog")
Path("/foo/bar/cat/dog")
I can see that this would make sense in some situations, but ISTM that it would make \
a great deal more sense (and be much more intuitive) to have concatenation include \
the separator character (i.e. be join).
=Tony.Meyer
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic