On Tue, Jul 8, 2014 at 1:15 AM, Benjamin Peterson <benja...@python.org> wrote:
> Why do you think that?
>
> % python
> Python 2.7.6 (default, May 29 2014, 22:22:15)
> [GCC 4.7.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> class x(object): pass
> ...
>>>> class y(object): pass
> ...
>>>> x != y
> True
>>>> x == y
> False

Your analysis is flawed - you're testing the equality of the types,
not of instances. But your conclusion's correct; testing instances
does work the same way you're implying:

rosuav@sikorsky:~$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class x(object): pass
...
>>> class y(object): pass
...
>>> x() != y()
True
>>> x() == y()
False
>>> x() == x()
False
>>> z = x()
>>> z == z
True

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to