Augmented Assignement (was: Re: PEP scepticism)

Thomas Wouters thomas at xs4all.net
Mon Jul 2 08:52:11 EDT 2001


On Mon, Jul 02, 2001 at 06:15:10AM +0000, Courageous wrote:

> x += (1,2,3)

> ... is not the same as...

> x=x+(1,2,3)

> That's just plain wrong.

No, that's the *whole intent* of the thing. If x += y was supposed to be
*exactly* the same as x = x + y, it would have been spelled as 'x = x + y'.
It isn't, and it's not. It's not supposed to be syntactic sugar for normal
addition, it's supposed to be syntactic sugar for a method call.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list