On Jun 6, 2008, at 4:27 PM, Ethan Furman wrote:

[EMAIL PROTECTED] wrote:
Hello,
I am testing object identity.
If I do it from the interpreter, I get strange results.
*print [] is []*
*False*
print id([]), id([])
3083942700 3083942700
Why is that? Isn't this an error?

in the first statement the two []'s are in memory at the same
time and have different id() signatures. For the second statement
the first id([]) is evaluated and release from memory and then
the second id([]) is evaluated and release from memory. Since
only one of them exist at a time they can have the same id()
signature.

Cheers
  Tommy
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to