Question about math.pi is mutable

Ben Finney ben+python at benfinney.id.au
Tue Nov 10 01:10:09 EST 2015


Steven D'Aprano <steve at pearwood.info> writes:

> Ben, I fear that you are not paying attention to me :-)

Possibly, though I also think there's miscommunication in this thread.

You speak of “compile time” and “run time”. You also speak of what the
compiler can do, at run time.

I am a Bear of Little Brain, but: Isn't anything that the *compiler*
does, by definition done at *compile* time?

The run-time behaviour of the program is, of course, *affected* by what
the compiler has done in the past. But the compiler acts only at compile
time, and its compile-time behaviour can't be determined by what's
happening at run time.

If that's not true, I fear we're not talking about the same things.

> At compile time, `func(x)` might do anything. But at runtime, we know
> exactly what it did, because it just did it.

Sure. All my statements about compile-time optimisations are those that
can be applied at compile time (which I intend to be synonymous with
“when the compiler is doing its job”), and so can't be informed by what
happens at run time.

If the proposal is to make optimisations that must be informed by the
run-time state of the running program, we're surely talking about not
just the compiler any more. No?

-- 
 \          “Any sufficiently advanced bug is indistinguishable from a |
  `\                                          feature.” —Rich Kulawiec |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list