Question about math.pi is mutable

Chris Angelico rosuav at gmail.com
Sun Nov 8 19:56:39 EST 2015


On Mon, Nov 9, 2015 at 11:50 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> You misunderstand me. I'm not saying the optimisations would be
> crippled. I am saying that, in order to achieve those optimisations, the
> *test code* would be crippled.
>
> I am pointing out that the assumption necessary for the optimisation
> BartC is advocating – the optimisation of module attributes to be
> immutable after compilation – depends on crippling the *functionality*
> needed for many uses, including test code uses.
>
> Since the compiler should not be in the position of deciding whether
> code is test code or not, it cannot use that criterion to decide whether
> to enable or disable the optimisation.
>
> So either the optimisation should never be enabled (my perference), or
> test code will unwittingly be crippled by the assumptions needed for
> that optimisation.

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). If it does indeed require crippling the functionality, then
I agree, this is a bad idea.

ChrisA



More information about the Python-list mailing list