How safe is a set of floats?

Arnaud Delobelle arnodel at googlemail.com
Fri May 4 12:50:50 EDT 2007


On May 4, 5:04 pm, Paul McGuire <p... at austin.rr.com> wrote:
> Does set membership test for equality ("==") or identity ("is")?  I
> just did some simple class tests, and it looks like sets test for
> identity.

Sets are like dictionaries, they test for equality:

>>> a=1,2
>>> b=1,2
>>> a is b
False
>>> a in set([b])
True

--
Arnaud




More information about the Python-list mailing list