Question about math.pi is mutable

Ben Finney ben+python at benfinney.id.au
Sun Nov 8 19:26:08 EST 2015


Chris Angelico <rosuav at gmail.com> writes:

> Testing/mocking is a completely separate consideration (eg you can
> inject a shadow for a built-in name)

Not for the purpose of making compiler optimisations, as BartC is
advocating.

The compiler definitely should not treat “is this code part of a test
suite?” as a relevant criterion for deciding what optimisation. We
should certainly not have a compiler that makes needless difference to
code behaviour under test conditions versus non-test conditions.

So, since those optimisations would cripple perfectly normal test code,
that should be sufficient to quash the desire to make them.

-- 
 \       “If you define cowardice as running away at the first sign of |
  `\   danger, screaming and tripping and begging for mercy, then yes, |
_o__)               Mr. Brave man, I guess I'm a coward.” —Jack Handey |
Ben Finney




More information about the Python-list mailing list