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.