special operator =+

Peter Hansen peter at engcorp.com
Fri Dec 16 20:38:25 EST 2005


Steve Holden wrote:
> Peter Hansen wrote:
>>bearophileHUGS at lycos.com wrote:
>>>kenny Nguyen>Does anyone know the operator "=+"?
>>>It isn't an operator, it's equivalent to = (assignment) only.
>>
>>Though actually it would try to call the __pos__ method on the object 
>>prior to binding it to the name on the left side.  (Much as - would call 
>>the __neg__ method if it existed.)  :-)
> 
> Technically one shouldn't really say "it", since the sequence can only 
> occur in an assignment or a keyword argument specification, and in all 
> cases it's actually two symbols, an "=" followed by a unary "+" operator.

I think it's okay if the "it" in question is the Python interpreter, as 
"it" is the thing that would be calling __pos__().  On the other hand, 
trying to sort out all the definitions of "it" in the above is probably 
at this point a rather Clintonesque endeavour.

-Peter




More information about the Python-list mailing list