title: Better way to control which blocks of code to be executed than using if-then statement in Python?
body: <p>I mostly work on data science/analysis. Often I need to test codes with and without random subsampling (if the original data is too large), sometimes show or hide results depending on if I am testing the code or to generate final results, as well as saving the final result/df in a .csv, among other things.</p>
  
  <p>I have been using this strategy which is to create a section at the beginning of my codes called "Control Panel" and in which I have set up a number of "switches" etc and user-defined parameters, like so</p>
  
  <pre><code># Control panel
  save_file_switch = False # WARNING: will overwrite existing when == True
  edge_date_inclusion = True # whether to include the last date in the range of inclusion criteria
  testing_printout_switch = False
  result_printout_switch = True
  df_subsampling_switch = False # WARNING: make to sure turn off for final results
  df_subsampling_n = 15000
  random_seed = 888
  </code></pre>
  
  <p>Later in my code, the block of code to be switched on or off will be determined by the value of the switch</p>
  
  <pre><code>if testing_printout_switch == True:
      print (df_results) # print some results
  </code></pre>
  
  <p>So far, I found it as a useful organizational tool, but I wonder if there is better and more pythonic way to approach this.</p>