title: How do you get the name of the program using argparse?
body: <p>I am using <code>argparse</code> to parse command line arguments. While going through the documentation for <a href="https://docs.python.org/3/library/argparse.html#module-argparse" rel="noreferrer"><code>argparse</code></a> I could only see a provision to use a different program name. </p>
  
  <p>I want to be able to use the default program name without having to import <code>sys</code>. There is nothing in <code>argparse</code>, as far as I can see, that will return the program name.</p>
  
  <pre><code>import argparse
  
  parser = argparse.ArgumentParser()
  args = parser.parse_args()
  
  print(dir(args))
  </code></pre>
  
  <p>And here's the output:</p>
  
  <p><code>['__class__', '__contains__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_get_args', '_get_kwargs']</code></p>
  
  <p>Is there any other way of retrieving the program name without having to import the <code>sys</code> module?</p>