A.T.Hofkamp wrote:

>>>>a = Car2(123)
>>>>b = Car2(123)
>>>>a == b
> 
> True
> 
>>>>set([a,b])
> 
> set([Car2(123), Car2(123)])
> 
> I get a set with two equal cars, something that never happens with a set
> my math teacher once told me.


Then your math teacher misspoke.
You have two different cars in the set,
just as expected.  Use `is`.
http://docs.python.org/ref/comparisons.html

This is good behavior.

Cheers,
Alan Isaac
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to