Python un-plugging the Interpreter
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Apr 20 04:13:27 EDT 2007
In <xRRVh.11903$Kd3.4637 at newssvr27.news.prodigy.net>, John Nagle wrote:
> Many cases are easy. If a smart compiler sees
>
> for i in range(n) :
> ... # something
>
> and there are no other assignments to "i", then it's clear that
> "i" can be represented as an integer, without "boxing" into a
> general object.
How is it clear that `i` is restricted to integers? That works only if
you assume `range` refers to the built-in `range()` function. So the
smart compiler has to check all possible control flows up to this point
and be sure `range` was not bound to something different.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list