total idiot question: +=, .=, etc...

Bernhard Reiter bernhard at
Mon Jun 28 19:41:22 CEST 1999

On Thu, 24 Jun 1999 09:27:16 +1200, Greg Ewing <greg.ewing at> wrote:
>Bernhard Reiter wrote:
>> += just saves some space and typing time.
>It's not quite as simple as that, because
>  a[i] = a[i] + expr
>  a[i] += expr
>would be semantically different if the former
>did the index lookup only once. 
I guess that using multiple evaluations and their side effects
are a not a good thing anyway. :)
And the python interpreter might optimise the former... >;-)

Research Assistant, Geog Dept UM-Milwaukee, USA.         (
Funding/Promoting Association for a Free Informational Infrastructure (

More information about the Python-list mailing list