This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients brett.cannon, larry, ncoghlan, r.david.murray, yselivanov
Date 2014-04-01.15:14:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396365272.84.0.0777403290447.issue21117@psf.upfronthosting.co.za>
In-reply-to
Content
@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?
History
Date User Action Args
2014-04-01 15:14:32yselivanovsetrecipients: + yselivanov, brett.cannon, ncoghlan, larry, r.david.murray
2014-04-01 15:14:32yselivanovsetmessageid: <1396365272.84.0.0777403290447.issue21117@psf.upfronthosting.co.za>
2014-04-01 15:14:32yselivanovlinkissue21117 messages
2014-04-01 15:14:32yselivanovcreate