The secrets of operator.add

Alex Martelli aleaxit at
Fri Dec 8 12:37:03 EST 2000

"Jacek Generowicz" <jmg at> wrote in message
news:g08zpq51vy.fsf at
> It looks as if multiple calls to operator.add are avoided somehow
> . . . or am I failing to understand the profiler's output ?

I think the profiler may be inserting its tracefunction in some
places and not others, thus perhaps distorting measurement.

> Is there a way of getting similar advantages in
> run ('map(lambda x:x+1, range(N))')  ?
> Is there a Python way of currying add?

There are several, e.g.:

def curry_add(n):
    def curried_add(x,n=n):
        return x+n
    return curried_add

but I doubt the actual performance will be noticeably different.


More information about the Python-list mailing list