Tim Peters <t...@python.org> added the comment:

Yes, what Steven said.  All kinds of functions (including, but not limited to, 
generator-iterators) are compared by object identity, nothing at all about 
internal state.  The contract of hash() is that if a == b, then we must have 
that hash(a) == hash(b) too.  That's got nothing to do with internal state 
either, _only_ with how __eq__ is implemented.

There is no sense in which any kind of function object is "mutable" that has 
any effect on its object identity, so also no sense in which it can affect 
__eq__ results, so no reason at all for __hash__ to care.  It's all working as 
designed and as intended.

----------

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

Reply via email to