[Python-Dev] Re: Caching objects in memory

Facundo Batista facundobatista at gmail.com
Mon Apr 25 18:46:15 CEST 2005

On 4/22/05, Fredrik Lundh <fredrik at pythonware.com> wrote:

> > Is there a document that details which objects are cached in memory
> > (to not create the same object multiple times, for performance)?
> why do you think you need to know?

I was in my second class of the Python workshop I'm giving here in one
Argentine University, and I was explaining how to think using
name/object and not variable/value.

Using id() for being pedagogic about the objects, the kids saw that
id(3) was always the same, but id([]) not. I explained to them that
Python, in some circumstances, caches the object, and I kept them
happy enough.

But I really don't know what objects and in which circumstances.

.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/

More information about the Python-Dev mailing list