Message215323
@Nick:
Ouch... I'm halfway through the implementation, and it seems like your idea isn't going to work.
Example (from unittest):
def foo(a=1, b=2, c=3): pass
_foo = partial(foo, a=10, c=13)
Now, the signature for "_foo", with your logic applied, will be:
(b=2, *, a=10, c=13)
If, however, you try to do the following call:
_foo(11)
It will fail with a TypeError "got multiple values for argument 'a'", because 'partial' will actually do this call:
foo(11, a=10, c=13)
I now remember this obstacle, that's why I have '_partial_kwarg'. So unfortunately, why I really like your idea, I don't think we can make it work.
Now, I still want to get rid the '_partial_kwarg' attribute. Are you guys OK, if I introduce PartialParameter & PartialSignature classes? |
|
Date |
User |
Action |
Args |
2014-04-01 15:14:32 | yselivanov | set | recipients:
+ yselivanov, brett.cannon, ncoghlan, larry, r.david.murray |
2014-04-01 15:14:32 | yselivanov | set | messageid: <1396365272.84.0.0777403290447.issue21117@psf.upfronthosting.co.za> |
2014-04-01 15:14:32 | yselivanov | link | issue21117 messages |
2014-04-01 15:14:32 | yselivanov | create | |
|