>>>>> "Diez B. Roggisch" <[EMAIL PROTECTED]> (DBR) wrote:

>DBR> So you can also do

>DBR> "" + some_object

>DBR> However,

>DBR> some_object + ""

>DBR> or

>DBR> 1 + ""

>DBR> don't work - the operator is only overloaded on the left argument.

There is no problem with 1+"" neither with new Integer(1)+"" in Java. Nor
any other object on the left hand side. The + operator is not tied to the
left hand side as in C++. if either side is a string and the other side has
a toString method it is OK. This is special-cased in the compiler. It is
defined in the language definition, not in the library definition.

-- 
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to