Scope rule pecularities

Carl Banks imbosol at aerojockey.invalid
Fri May 7 01:13:50 EDT 2004


Holger T?rk wrote:
> a1 += b
> 
> is not a shortcut for
> 
> a1.__iadd__ (b)
> 
> but for
> 
> a1 = a1.__iadd__ (b)
> 
> with the advantage of a1 evaluated only once.


Nitpick:

a1 is only evaluated once in both of them.  If it were (for example)
a1[0] instead of a1, then a1 would be evaluated once in the former,
twice in the latter.


-- 
CARL BANKS                      http://www.aerojockey.com/software
"If you believe in yourself, drink your school, stay on drugs, and
don't do milk, you can get work." 
          -- Parody of Mr. T from a Robert Smigel Cartoon



More information about the Python-list mailing list