Re: Small change to utils.functional.curry

2006-09-07 Thread Michael Spencer
Marc D.M. wrote: > On Wed, 2006-09-06 at 22:49 -0700, Michael Spencer wrote: >> If you're really hunting for speed, there is a significant boost available >> in >> the common special case of a python function curried with one positional >> argument. In this case, you can [ab]use the method bin

Re: Small change to utils.functional.curry

2006-09-07 Thread Michael Spencer
Marc D.M. wrote: > On Thu, 2006-09-07 at 13:28 -0500, Adrian Holovaty wrote: >> On 9/7/06, Michael Spencer <[EMAIL PROTECTED]> wrote: >> >>> If you're really hunting for speed, there is a significant boost available >>> in >>> the common special case of a python function curried with one positio

Re: Small change to utils.functional.curry

2006-09-07 Thread Marc D.M.
On Thu, 2006-09-07 at 13:28 -0500, Adrian Holovaty wrote: > On 9/7/06, Michael Spencer <[EMAIL PROTECTED]> wrote: > > Martin's version is indeed faster, but has a 'gotcha' in that it precludes > > passing a keyword arguments named 'fct' to a curried function... > > [...] > > Better to rename fct t

Re: Small change to utils.functional.curry

2006-09-07 Thread Adrian Holovaty
On 9/7/06, Michael Spencer <[EMAIL PROTECTED]> wrote: > Martin's version is indeed faster, but has a 'gotcha' in that it precludes > passing a keyword arguments named 'fct' to a curried function... > [...] > Better to rename fct to something less likely to clash, such as _curried_fct Good call, M

Re: Re: Small change to utils.functional.curry

2006-09-07 Thread James Bennett
On 9/7/06, Michael Spencer <[EMAIL PROTECTED]> wrote: > Martin's version is indeed faster, but has a 'gotcha' in that it precludes > passing a keyword arguments named 'fct' to a curried function... If you look at the changeset checked in by Adrian[1], it's slightly different than Martin's origina

Re: Small change to utils.functional.curry

2006-09-07 Thread Marc D.M.
On Wed, 2006-09-06 at 22:49 -0700, Michael Spencer wrote: > If you're really hunting for speed, there is a significant boost available in > the common special case of a python function curried with one positional > argument. In this case, you can [ab]use the method binding machinery, e.g.: > >

Re: Small change to utils.functional.curry

2006-09-06 Thread Michael Spencer
Adrian Holovaty wrote: > On 9/6/06, Martin <[EMAIL PROTECTED]> wrote: >> def curry(fct, *args, **kwargs): >> def _curried(*moreargs, **morekwargs): >> return fct (* (args+moreargs), **dict(kwargs, ** morekwargs)) >> return _curried >> >> It's just a performance issue (saving a few

Re: Small change to utils.functional.curry

2006-09-06 Thread Adrian Holovaty
On 9/6/06, Martin <[EMAIL PROTECTED]> wrote: > def curry(fct, *args, **kwargs): > def _curried(*moreargs, **morekwargs): > return fct (* (args+moreargs), **dict(kwargs, ** morekwargs)) > return _curried > > It's just a performance issue (saving a few list operations) andbecause > I

Small change to utils.functional.curry

2006-09-06 Thread Martin
Just because I stubled on the code of curry (I had to find out what this function really does). It's not a big of a deal, but I think it would be better to change the function from the current implementation: def curry(*args, **kwargs): def _curried(*moreargs, **morekwargs): return a