Question about math.pi is mutable

BartC bc at freeuk.com
Mon Nov 9 11:54:21 EST 2015


On 09/11/2015 01:04, Ben Finney wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>
>> Hmm, then I was misunderstanding what BartC was advocating. I didn't
>> think it would *fail* in the presence of dynamic attributes, but
>> merely *perform suboptimally* (and presumably worse than current
>> CPython).
>
> There isn't a way for the compiler to *know*, in all cases, whether
> module attributes will be updated during the lifetime of the program

In what way can an attribute be updated, other than deleting it altogether?

(Moving or renaming can be done in terms of creation and deletion. For 
the purposes of trying to avoid a lookup, we're not that interested in 
much else.)

-- 
Bart C.





More information about the Python-list mailing list