Is there a way to do the following preprocessor directives in Python?
#if DEBUG & LT; Make some code & gt; #lice & lt; Some other code & gt; #endif
contains the __debug____ There is a special value that the compiler pre-process
if __debug__: print "If it prints, then you are not running Python." Else: print "If it prints, then you're running a dragon!" __debug __ will be replaced by the compiler with constant 0 or 1, and the adapter will remove any if 0: The first line means your source.
Comments
Post a Comment