On 4/25/05, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > 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. > > Aargh! Bad explanation. Or at least you're missing something:
Not really. It's easier for me to show that id(3) is always the same and id([]) not, and let the kids see that's not so easy and you'll have to look deeper if you want to know better. If I did id(3) and id(500), then the difference would look more subtle, and I would had to explain it longer. Remember, it was the second day (2 hours per day). > implementation is free to use caching. In practice, I believe ints > between -5 and 100 are cached, and 1-character strings are often > cached (but not always). These are exactly my doubts, ;). . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com