Augmented Assignement (was: Re: PEP scepticism)

Remco Gerlich scarblac at pino.selwerd.nl
Thu Jul 12 05:45:21 EDT 2001


Paul Prescod <paulp at ActiveState.com> wrote in comp.lang.python:
> "This" is the simplest interpretation x +=y is equivalent to x = x + y.
> 
> "That" is the more sophisticated polymorphic interpretation where the
> type chooses its own behaviour.
> 
> Would this be an acceptable compromise? Everyone wins.

I believe that the current behavior is exactly what I want almost all the
time. If I have a list, I most often want to append to it; if it's a tuple
or integer, then of course I couldn't, and what I meant is adding it and
making a new object.

The problem really doesn't show up for me. This design is an excellent
pragmatical choice.

-- 
Remco Gerlich



More information about the Python-list mailing list