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 _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )