Nick Coghlan added the comment:

I believe Yury already figured out what I meant, but to make it entirely clear, 
after the change, this example:

   def foo(a, b): pass
   foo_partial = functools.partial(foo, 'spam')
   foo_partial2 = functools.partial(foo, a='spam')

Should lead to the following signature for both "foo_partial" and 
"foo_partial2":

    (b, *, a='spam')

That accurately indicates that "a" is now effectively a keyword only parameter 
- the first supplied positional argument will map to "b", and attempting to 
supply *two* positional arguments will fail.

Correctly handing *args may get a little interesting, but should be feasible.

----------
stage:  -> needs patch
title: inspect: PartialSignature and PartialParameter classes -> 
inspect.signature: inaccuracies for partial functions
type: enhancement -> behavior
versions: +Python 3.4

_______________________________________
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