[Python-Dev] About [].append == [].append (original) (raw)

Guido van Rossum guido at python.org
Fri Jun 22 11:13:44 EDT 2018


Honestly it looks to me like the status quo is perfect.

a = [] a.append is a.append False a.append == a.append True b = [] a.append == b.append False

On Thu, Jun 21, 2018 at 10:02 PM Serhiy Storchaka <storchaka at gmail.com> wrote:

22.06.18 00:04, Ivan Pozdeev via Python-Dev пише: > On 21.06.2018 23:40, Guido van Rossum wrote: >> 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. >> > In this light, methods rather shouldn't have a rich comparison logic at > all

This would be so if you get the same method object when resolve an attribute. But a.f is not a.f. Every time a new method object is created. If we want a.f == a.f, we need to implement a rich comparison logic. > -- at the very least, until we have a realistic use case and can > flesh out the requirements for it. There are realistic use cases. You will get a number of failures in the Python tests if make method objects incomparable.


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180622/227562c3/attachment.html>



More information about the Python-Dev mailing list