The secrets of operator.add

Martin von Loewis loewis at
Sat Dec 9 05:49:18 EST 2000

"June Kim" <junaftnoon at> writes:

> How come the huge difference in its total running time between the two?

My guess it's because of the lambda function: That will give you a
number of extra functions on the C stack, and in particular another
Python ceval invocation, along with a frame object and everything.

OTOH, operator.add is a builtin, which is invoked from reduce without
further ado.


More information about the Python-list mailing list