"/a" is not "/a" ?

Robert Kern robert.kern at gmail.com
Fri Mar 6 19:53:09 EST 2009


On 2009-03-06 18:29, Paul Rubin wrote:
> Steven D'Aprano<steve at 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




More information about the Python-list mailing list