curiosity about the nature of identity (in python)

Grant Edwards grante at
Thu Jun 29 00:20:13 CEST 2006

On 2006-06-29, Bruno Desthuilliers <bdesth.quelquechose at> wrote:

> Now what about this:
>>>> id(600)
> 134745616
>>>> id(601)
> 134745616
> id of an object is unique *for the lifetime of this object*. Nothing 
> prevents it from being reused later.

Indeed.  Since in CPython, it's the address of a C language
data structure, if IDs didn't get re-used, then the virtual
memory size of any long-running Python program would grow
without bound. The working set would grow more slowly that the
total virtual size, but it would still be problematic.

Grant Edwards                   grante             Yow!  I'm GLAD I
                                  at               remembered to XEROX all
                                 my UNDERSHIRTS!!

More information about the Python-list mailing list