On 2009-03-06 18:29, Paul Rubin wrote:
Steven D'Aprano<st...@pearwood.info>  writes:
It is never
correct to avoid using "is" when you need to compare for identity.

When is it ever necessary to compare for identity?

Caches of arbitrary objects.

When checking if an object (which may be have an arbitrarily perverse __eq__) is None.

Or a specifically constructed sentinel value.

Checking for cycles in a data structure that defines __eq__.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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

Reply via email to