Yury Selivanov added the comment:

@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.

----------

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

Reply via email to