Author Antony.Lee
Recipients Antony.Lee, brett.cannon, larry, ncoghlan, python-dev, yselivanov
Date 2014-08-15.06:01:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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
>>> hash(s1) == hash(s2)

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.
Date User Action Args
2014-08-15 06:01:40Antony.Leesetrecipients: + Antony.Lee, brett.cannon, ncoghlan, larry, python-dev, yselivanov
2014-08-15 06:01:40Antony.Leesetmessageid: <>
2014-08-15 06:01:40Antony.Leelinkissue20334 messages
2014-08-15 06:01:40Antony.Leecreate