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

Bernhard Reiter bernhard at alpha1.csd.uwm.edu
Mon Jun 28 13:41:22 EDT 1999


On Thu, 24 Jun 1999 09:27:16 +1200, Greg Ewing <greg.ewing at compaq.com> 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
>and
>  a[i] += expr
>
>would be semantically different if the former
>did the index lookup only once. 
True.
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... >;-)
	Bernhard


-- 
Research Assistant, Geog Dept UM-Milwaukee, USA.         (www.uwm.edu/~bernhard)
Funding/Promoting Association for a Free Informational Infrastructure (ffii.org)




More information about the Python-list mailing list