title: How to make sys.argv arguments optional?
body: <p><code>sys.argv</code> takes arguments at the shell command line when running a program. How do I make these arguments optional?</p>
  
  <p>I know I can use <code>try</code> - <code>except</code>. But this forces you to insert either no extra arguments or all extra arguments, unless you nest more <code>try</code> - <code>except</code> which makes the code look much less readable.</p>
  
  <h2>Edit</h2>
  
  <p>Suppose I would want the following functionality, how do I implement this?</p>
  
  <pre><code>$ python program.py add Peter 
  'Peter' was added to the list of names.
  </code></pre>
  
  <p>This <code>add</code> argument (and not <code>--add</code>) is optional such that</p>
  
  <pre><code>$ python program.py
  </code></pre>
  
  <p>just runs the program normally.</p>