Simple question about how the optimizer works
Robert Amesz
sheershion at mailexpire.com
Tue May 14 14:45:29 EDT 2002
Tim Roberts wrote:
> Kragen Sitaker <kragen at pobox.com> wrote:
>
>>Simon Brunning <SBrunning at trisystems.co.uk> writes:
>>> I can't see how this optimisation could be automated - function
>>> f may or may not have side effects.
>>
>>Checking whether f has side effects can be automated.
>
> Can it? Isn't that a variant of the Turing stopping problem?
Not really, because recursion - direct or indirect - can be detected,
and that branch of the checking tree can be safely chopped off (you
can't get _more_ potential side effects by calling the same function
twice). The process is therefore guaranteed to terminate.
Robert Amesz
More information about the Python-list
mailing list