Bitten by my C/Java experience

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed May 6 07:15:42 EDT 2015


Steven D'Aprano wrote:

> The first one just does a name lookup and then throws the result away. The 
> second one looks up names a and b, then adds them together, throwing away 
> the result.

Actually, it's worse than that. :-) It's possible for a to
have an __add__ method with a side effect, although that
would be evil.

It's also possible for merely looking up a name to have
a side effect, if it's done in the right context -- but
that would be even more evil.

-- 
Greg



More information about the Python-list mailing list