expression in an if statement

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Aug 22 19:37:18 EDT 2010


Thomas Jollans wrote:
> What if "set" has side effects? A 
> compiler could only exclude this possibility if it knew exactly what "set" 
> will be at run time,

And also that 'a' remains bound to the same object, and that
object or anything reachable from it is not mutated in
any way that could affect the result of set(a). That's
quite a lot of information for an optimiser to deduce,
particularly in a language as dynamic as Python.

-- 
Greg



More information about the Python-list mailing list