Seemingly odd 'is' comparison.

Christian Heimes lists at cheimes.de
Tue Feb 19 11:01:05 EST 2008


Asun Friere wrote:
> So was that a yes or no?  I mean is it even possible for the identity
> behaviour of mutables to vary between implementations?  I can't see
> how they can possibly be interned, but is there some other factor I'm
> missing in regard to identity behaviour which could in fact vary
> between implementations?

In CPython some strings are interned (see the intern builtin). The free
list of lists, tuples, dict and the block allocation of ints and floats
can have  an interning like effect, too.

IronPython and Jython may not have interning or free list at all. Even
in CPython the interning and free lists are an implementation detail
that may chance between releases. In a matter of fact I'm messing around
with free lists to speed up Python 2.6/3.0 and to give back memory earlier.

Christian




More information about the Python-list mailing list