What's the overhead of assertion or debug statements in Python?
danieleloff at hotmail.com
Sat Jul 17 07:23:52 CEST 2004
I've just started programming with Python, but I've heard it has a
feature rare among interpreted languages - Debug statements.]
According to the docs, assert() produces no code if optimization is
My question is, is the same true for
print "Reached this region of code", some_debug_func()
Is there any overhead associated with this at runtime? Any branching or
run time evaluation of the value of __debug__?
I'm trying to discover if I can litter my code with debug stuff, or if I
should go sparingly in performance critical code like some innermost
Also, how can I enable and disable optimization?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list