title: Parsing boolean values with argparse
body: <p>I would like to use argparse to parse boolean command-line arguments written as "--foo True" or "--foo False". For example:</p>
  
  <pre><code>my_program --my_boolean_flag False
  </code></pre>
  
  <p>However, the following test code does not do what I would like:</p>
  
  <pre><code>import argparse
  parser = argparse.ArgumentParser(description="My parser")
  parser.add_argument("--my_bool", type=bool)
  cmd_line = ["--my_bool", "False"]
  parsed_args = parser.parse(cmd_line)
  </code></pre>
  
  <p>Sadly, <code>parsed_args.my_bool</code> evaluates to <code>True</code>. This is the case even when I change <code>cmd_line</code> to be <code>["--my_bool", ""]</code>, which is surprising, since <code>bool("")</code> evalutates to <code>False</code>.</p>
  
  <p>How can I get argparse to parse <code>"False"</code>, <code>"F"</code>, and their lower-case variants to be <code>False</code>?</p>