<div dir="auto">I'm with Serhiy here, for mutable values I don't think the methods should compare equal, even when the values do. For immutables I don't care either way, it's an implementation detail.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 21, 2018, 12:55 Serhiy Storchaka <<a href="mailto:storchaka@gmail.com">storchaka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">21.06.18 14:25, Jeroen Demeyer пише:<br>
> Currently, we have:<br>
> <br>
>  >>> [].append == [].append<br>
> False<br>
> <br>
> However, with a Python class:<br>
> <br>
>  >>> class List(list):<br>
> ....     def append(self, x): super().append(x)<br>
>  >>> List().append == List().append<br>
> True<br>
<br>
I think this is a bug. These bound methods can't be equal because they <br>
have different side effect.<br>
<br>
The use case for using "is" for __self__ is described by the OP of <br>
issue1617161. I don't know use cases for using "==".<br>
<br>
There is a related problem of hashing. Currently<br>
bound methods are not hashable if __self__ is not hashable. This makes <br>
impossible using them as dict keys.<br>
<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank" rel="noreferrer">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</blockquote></div>