The secrets of operator.add

Martin von Loewis loewis at informatik.hu-berlin.de
Sat Dec 9 11:49:18 CET 2000


"June Kim" <junaftnoon at nospamplzyahoo.com> 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.

Regards,
Martin



More information about the Python-list mailing list