title: Python equivalent for #ifdef DEBUG
body: <p>In C we write code like</p>
  
  <pre><code>#ifdef DEBUG
  printf("Some debug log... This could probably be achieved by python logging.Logger");
  /* Do some sanity check code */
  assert someCondition
  /* More complex sanitycheck */
  while(list-&gt;next){
  assert fooCheck(list)
  }
  
  #endif
  </code></pre>
  
  <p>Is there a way to do this in python?</p>
  
  <p>Edit: I got my answer, and more :)
  Paolo, Steven Rumbalski and J Sebastian gave me the information I was looking for. Thanks das for the detailed answer, although I'll probably not use a preprocessor right now.</p>
  
  <p>J Sebastian, whose comment got deleted because the answer in which he posted his comment, deleted his answer I think.
  He said I could use the isEnabledFor() method in Logger to feed a conditional.</p>
  
  <p>Thanks everyone for your inputs. This is my first question. I wish I could accept paolo, or j sebastian's answers. But since those were offered as comments, I'll accept das' answer.</p>
  
  <p>I will probably use either <a href="http://nestedinfiniteloops.wordpress.com/2012/01/15/if-debug-python-flavoured/" rel="noreferrer">http://nestedinfiniteloops.wordpress.com/2012/01/15/if-debug-python-flavoured/</a> or Logger.isEnabledFor()</p>