Lizhi Yang wrote:
Is there anything similar to ifdef statement in C or C++ in python?

Not really, but python's regular if can be used for a similar purpose:

DEBUG = True

if DEBUG:
    import logging
    def foo():
        # debug version
else:
    def foo():
        # normal version

def main():
    foo()

if __name__ == '__main__':
    main()

or something like that.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to