Message215286
@Nick:
Agreed on positional-only stuff.
> If arguments bound by position disappear from the signature, and those
> bound by keyword are mapped to keyword-only parameters with a default, we
> should get a valid and accurate signature.
But what about my example from the first message:
def foo(a, b): pass
foo_partial = functools.partial(foo, 'spam')
'foo_partial' now has the following signature: (a='spam', b); where 'a' is a positional_or_keyword parameter, i.e. you can still do 'foo_partial(10, 20)', or 'foo_partial(b=20, a=10)'.
(a='spam', b) is not a valid python pure function signature, but is a perfectly valid signature of partial function. And since its arguments aren't positional-only, we shouldn't hide anything.
That's why I have this private '_partial_kwarg' attribute, which I don't like and want to remove by adding a PartialParameter subclass. Otherwise, we have something that is hidden and non-documented, but affects Parameter.__hash__ and some other logic. |
|
Date |
User |
Action |
Args |
2014-04-01 00:01:44 | yselivanov | set | recipients:
+ yselivanov, brett.cannon, ncoghlan, larry, r.david.murray |
2014-04-01 00:01:43 | yselivanov | set | messageid: <1396310503.87.0.0172810366683.issue21117@psf.upfronthosting.co.za> |
2014-04-01 00:01:43 | yselivanov | link | issue21117 messages |
2014-04-01 00:01:43 | yselivanov | create | |
|