[Python-Dev] Possible patch for functools partial (original) (raw)
Daniel Urban urban.dani at gmail.com
Thu May 13 18:48:15 CEST 2010
- Previous message: [Python-Dev] Possible patch for functools partial - Interested?
- Next message: [Python-Dev] Possible patch for functools partial - Interested?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, May 13, 2010 at 13:30, Steven D'Aprano <steve at pearwood.info> wrote:
I'd support an immutable dict. partial objects already impose a significant (~ 30%) performance penalty:
from timeit import Timer min(Timer('f(5)', 'f = lambda x: x').repeat()) 0.93580079078674316 min(Timer('p(5)', 'from functools import partial; p = partial(lambda x: x)').repeat()) 1.2715129852294922 No need to make that worse if that can be avoided.
I've made a new patch, in which the keywords attribute is a read-only proxy of the dictionary. I've used your benchmark, and I haven't found any significant difference in execution times. The patch is in the tracker (http://bugs.python.org/issue8699) and Rietveld (http://codereview.appspot.com/1179044).
Daniel Urban
- Previous message: [Python-Dev] Possible patch for functools partial - Interested?
- Next message: [Python-Dev] Possible patch for functools partial - Interested?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]