Optimization

Aahz Maruch aahz at netcom.com
Sun Oct 31 15:51:41 EST 1999


In article <381B479B.6C73707E at c2i.net>,
Geir Bjarte Terum  <gterum at c2i.net> wrote:
>
>Will statements like this be optimized away using the -o program switch?
>
>if __debug__:
>  <statements>  # Dead code in optimized version.
>
>Is there any way to define similar *variables* for other purposes?

I'd suggest something like:

if MyDebugFlag :
    assert DebugFunction()

The if doesn't get optimized, but everything else does, particularly if
DebugFunction is in a module that only gets imported if MyDebugFlag is
set.
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>      http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6  (if you want to know, do some research)




More information about the Python-list mailing list