expression in an if statement

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Aug 23 01:37:18 CEST 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