Yury Selivanov added the comment:

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

----------

_______________________________________
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