Question about math.pi is mutable
Random832
random832 at fastmail.com
Mon Nov 9 10:32:17 EST 2015
Steven D'Aprano <steve at pearwood.info> writes:
> The compiler doesn't need to decide in advance whether or not the module
> attributes have been changed. It can decide that at runtime, just before
> actually looking up the attribute. In pseudo-code:
>
> if attribute might have changed:
> use the slow path just like today
> else:
> use the optimized fast path
if attribute might have changed:
check if attribute really did change
if it didn't:
reset means of determining if it might have changed
goto the optimized fast path
else:
use the slow path and/or maybe make a new fast path
else:
use the optimized fast path
And what if your optimization depends on _two_ things that might change?
Do you create one really fast path and two sort of fast paths?
More information about the Python-list
mailing list