Python and Boehm-Demers GC, I have code.
Michael Hudson
mwh21 at cam.ac.uk
Tue Jul 20 07:56:21 EDT 1999
On 20 Jul 1999, Markus Kohler wrote:
[snippety snip]
>
> Is there anything that would prevent someone to reimplement loops such
> that only one variable is allocated ?
>
Yes. The fact that ints are immutable. Consider:
for i in xrange(10):
if i == 2:
j = i
if the loop only allocated one variable, then at the end of the loop
'print j' would give the answer '9'!
I guess this could be worked around by inspecting refcounts and such...
but not easily.
there's-the-small-integer-cache-to-worry-about-too-ly y'rs
Michael
More information about the Python-list
mailing list