[path-PEP] Path inherits from basestring again
Peter Hansen
peter at engcorp.com
Wed Jul 27 21:48:34 EDT 2005
Ron Adam wrote:
> Michael Hoffman wrote:
>> Ron Adam wrote:
>>> In all current cases, (that I know of), of differing types, '+'
>>> raises an error.
>>
>> Not quite:
>> >>> "hello " + u"world"
>> u'hello world'
>> >>> 4.5 + 5
>> 9.5
>>
> In the case of numeric types, it's an addition and not a join. I should
> have specified in 'all cases, (I know of), where '+' is used to join
> objects, but I thought that was clear from the context of the
> discussion. I haven't needed to use unicode yet, so it didn't come to
> mind.
I believe Michael intended to show that "4.5 + 5" actually represents
using + with two different types, specifically a float and an int, thus
giving at least two common cases where errors are not raised.
(While the issue of "addition" vs. "join" is merely a (human) language
issue... one could just as well say that those two numbers are being
"joined" by the "+".)
-Peter
More information about the Python-list
mailing list