On Thu, 29 Mar 2007 14:55:04 -0300, Gabriel Genellina wrote: > En Thu, 29 Mar 2007 01:56:15 -0300, Steven D'Aprano > <[EMAIL PROTECTED]> escribió: > >> By the way, "id(obj) == id(another_object)" is just a long way of writing >> "obj is another_object". > > Just as a side note: that's not true, testing by id() only works if both > objects are alive at the same time.
Correction noted. > py> id(object()) == id(object()) > True > py> object() is object() > False That's weird. How on earth does that happen? > So using the `is` operator is the only safe way to test for identity. But if an object can be garbage collected before the is operator does the comparison, how can that be safe? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list