Gabriel Genellina wrote:
En Wed, 28 Jan 2009 01:36:57 -0200, Steve Holden <st...@holdenweb.com>
escribió:
Gabriel Genellina wrote:
En Tue, 27 Jan 2009 22:17:16 -0200, Robert Kern <robert.k...@gmail.com>
escribió:
I *thought* I did understand this until I came to this example:
1)
id(globals()), id(locals())
(11239760, 11239760)
This is a bad test. We know distinct objects are distinct, but:
>>> print id(object()), id(object())
10598120 10598120
>>> a = object(); b = object()
>>> print id(a), id(b)
10598120 10598128
The reason is that once your created object has its id taken, you
must keep a handle on it, otherwise it may get recycled and reused.
That is, id(var1) == id(var2) implies var1 is var2,
but id(expr1) == id(expr2) does not even imply expr1 == expr2
--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list