Python's garbage collection was Re: Python reliability

Jorgen Grahn jgrahn-nntq at algonet.se
Wed Oct 12 18:40:53 CEST 2005


On Mon, 10 Oct 2005 20:37:03 +0100, Tom Anderson <twic at urchin.earth.li> wrote:
> On Mon, 10 Oct 2005, it was written:
...
>> There is no way you can avoid making garbage.  Python conses everything, 
>> even integers (small positive ones are cached).
>
> So python doesn't use the old SmallTalk 80 SmallInteger hack, or similar? 

If the SmallInteger hack is something like this, it does:

>>> a = 42
>>> b = 42
>>> a is b
True
>>> a = 42000
>>> b = 42000
>>> a is b
False
>>>

... which I guess is what if referred to above as "small positive
ones are cached".

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list