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 vstinner
Recipients rhettinger, serhiy.storchaka, vstinner
Date 2016-08-23.14:34:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471962843.41.0.64844621448.issue27840@psf.upfronthosting.co.za>
In-reply-to
Content
I justed optimized partial_call() for positional arguments in the change c1a698edfa1b to avoid the creation of a temporary tuple when possible.

I noticed that keyword parameters from partial() constructor are always copied. Is it mandatory? Can't we avoid copying them?

Example:
---
import functools
hello = functools.partial(print, "Hello World", end='!\n')
hello()
---

hello keyword arguments are {'end'; '!\n'}.

Attached patch avoids copying keyword arguments when the partial objects is not called with new keyword arguments.

Tests pass, but I don't know if there is a risk that some strange function modify keyword arguments in-place?
History
Date User Action Args
2016-08-23 14:34:03vstinnersetrecipients: + vstinner, rhettinger, serhiy.storchaka
2016-08-23 14:34:03vstinnersetmessageid: <1471962843.41.0.64844621448.issue27840@psf.upfronthosting.co.za>
2016-08-23 14:34:03vstinnerlinkissue27840 messages
2016-08-23 14:34:03vstinnercreate