This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients brett.cannon, larry, ncoghlan, r.david.murray, yselivanov
Date 2014-04-01.13:59:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
OK, I didn't even realize that was possible with partial.  Now I understand Yuri's original point.  His example is wrong:

>>> def foo(a, b):
...    print(a, b)
>>> x2 = partial(foo, 'x')
>>> str(inspect.signature(x2))

This is the correct example:

>>> x = partial(foo, a='x')
>>> x('b')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: foo() got multiple values for argument 'a'

The current signature for this is the one Yuri gave:

>>> str(inspect.signature(x))
"(a='x', b)"

Which is about as close as one can come to the rather non-intuitve (non-pythonic?) behavior that partial has here.  Perhaps this a bug in partial?  If so it is unfortunately one with ugly backward compatibility implications.
Date User Action Args
2014-04-01 13:59:25r.david.murraysetrecipients: + r.david.murray, brett.cannon, ncoghlan, larry, yselivanov
2014-04-01 13:59:25r.david.murraysetmessageid: <>
2014-04-01 13:59:25r.david.murraylinkissue21117 messages
2014-04-01 13:59:24r.david.murraycreate