Return value of an assignment statement?

Paul Rubin http
Fri Feb 22 19:49:20 EST 2008


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> Personally, I think the confusion of augmented assignments is not worth 
> the benefit of saving typing a couple of characters. I think Guido's 
> first decision, to leave += etc out of the language, was the right 
> decision.

It quite helpful to be able to say

  foo['bar'+lookup(baz)][blob(a)+frob(b)] += 1

without having to split it into separate statements to avoid repeating
the function calls and their possible side effects.



More information about the Python-list mailing list