On Thu, Jun 21, 2018 at 2:04 PM, Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote: > 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 > -- at the very least, until we have a realistic use case and can flesh out > the requirements for it.
== and hashing for methods can be quite useful for things like cache keys. (E.g., a dict mapping callable+args -> result.) I'm sure people are using it. So I think simply removing it would be pretty disruptive. I can't think of any cases where == and hashing are useful for methods on *mutable objects*, which is that case where it matters whether the 'self' comparison uses == or 'is', but the method object doesn't know whether 'self' is mutable, so it has to either work in general or not work in general. -n -- Nathaniel J. Smith -- https://vorpus.org _______________________________________________ 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