Antony Lee added the comment:

The hash function of the Signature class is actually incompatible with the 
definition of Signature equality, which doesn't consider the order of 
keyword-only arguments:

>>> from inspect import signature
>>> s1 = signature(lambda *, x, y: None); s2 = signature(lambda *, y, x: None)
>>> s1 == s2
True
>>> hash(s1) == hash(s2)
False

Actually the implementation of Signature.__eq__ seems way too complicated; I 
would suggest making a helper method returning (return_annotation, 
tuple(non-kw-only-params), frozenset(kw-only-params)) so that __eq__ can 
compare these values while __hash__ can hash that tuple.

----------
nosy: +Antony.Lee

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

Reply via email to