With respect to the overhead of inserting things into modules in the 
source code, Fred Drake (I think!) pointed out to me that constructs in 
the form

    if __debug__: ...

are automatically removed by the parser when Python is run with the -O flag.

Note that I am *not* sure how Zope performs when run with Python -O. 
 However, assuming it does run OK, then it makes sense to put all sorts 
of conditional things into code which are disabled for performance when 
-O is passed on the command line to Python.

Also note that I guarantee Zope will not run with Python -OO, as this 
removes doc strings, which the Publisher relies upon.

At the time, I was pushing more for a slightly more complex form of run 
time diagnostic control without the overhead of continuous symbol 
lookup, e.g. ifcondition(bitmask): such that either all the bits in the 
bitmask were "enabled" in the current debugging context, or at least 
some of them were.

Then again, I effectively want exits in Python's ceval.c at various 
locations to be able to do "magic" without the burden of more 
interpretation.  For instance, there are actually some clever things you 
can do with the new C level profiler, but 'stealing' the profiler to do 
other magic is not really the right approach.

Matt Kromer
Zope Corporation  http://www.zope.com/ 

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to