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

Greg Ewing greg.ewing at compaq.com
Wed Jun 23 17:27:16 EDT 1999


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. However, there
are serious difficulties with trying to incorporate
such semantics into Python's execution model,
and the consensus among experienced Python
implementation hackers seems to be that the results
would be Not Worth The Bother (tm).

Greg




More information about the Python-list mailing list