On 4/25/05, Guido van Rossum <gvanrossum at gmail.com> 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/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4