[Zope] lambda's in external methods
Dieter Maurer
dieter at handshake.de
Wed Jan 16 13:15:06 EST 2008
David Bear wrote at 2008-1-15 20:21 -0700:
>In the zope 2.7 book it mentions that an optimization technique for
>external methods is to compile regular expressions in global scope to
>the module. The re's will then be compiled at zope load time.
>
>I am wondering if the same holds for lambdas.
"lambda"s are (as well as any static Python code) compiled at
load time -- independent of their position.
When you move the "lambda" to the top level, then the "lambda" object, too,
is build at load time. Otherwise, the object is build when the
function containing the "lambda" reaches the lambda.
However, construction this object from the predefined pieces is not
very expensive.
--
Dieter
More information about the Zope
mailing list