New submission from Jeroen Demeyer <j.deme...@ugent.be>:

Methods of Python functions compare equal if the functions are equal and if 
__self__ is equal:

>>> class X:
...     def __eq__(self, other): return True
...     def meth(self): pass
>>> X().meth == X().meth
True

This is because X() == X() even though X() is not X().

For extension types, we get instead:

>>> [].append == [].append
False

This is because comparison is done with "is" instead of "==". This is a 
needless difference.

----------
messages: 320148
nosy: jdemeyer
priority: normal
severity: normal
status: open
title: builtin_function_or_method compares __self__ by identity instead of 
equality

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33925>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to