title: How do I set an Argparse argument's default value to a positional argument's value?
body: <p>I have a python script that sends a GET request. It uses Argparse to take three arguments:</p>
  
  <ol>
  <li><strong>Address</strong>: where to send the GET request</li>
  <li><strong>Host</strong>: the host to declare in the GET request</li>
  <li><strong>Resource</strong>: which resource is being requested</li>
  </ol>
  
  <p>An example usage might be:</p>
  
  <p><code>$ python get.py 198.252.206.16 stackoverflow.com /questions/ask</code></p>
  
  <p>In most cases, however, only the host and the resource need to be given as the host will resolve to the address:</p>
  
  <pre><code> $ host -t a stackoverflow.com
   stackoverflow.com has address 198.252.206.16
  </code></pre>
  
  <p>So desired usage might be:</p>
  
  <pre><code>$ python get.py stackoverflow.com /questions/ask
  </code></pre>
  
  <p>How do I set up Argparse so that the default value of the Address argument is the value of the Host argument?</p>
  
  <hr>
  
  <p>I've been asked to show the code that currently parses the arguments. Here it is:</p>
  
  <pre><code>import argparse
  
  parser = argparse.ArgumentParser(description=
           'Send a GET request and obtain the HTTP response header and/or body.')
  
  parser.add_argument("-v", "--verbose",
                      help="Turn on verbose mode.",
                      action="store_true")
  parser.add_argument("-p", "--port",
                      type=int,
                      default=80,
                      help="Which port to use when sending the GET request."
  parser.add_argument("address",
                      help="Where to send the GET request to.")
  parser.add_argument("host",
                      help="Which Host to declare in the GET request.")   
  parser.add_argument("resource",
                      help="Which resource to request.")
  
  parser.parse_args()
  </code></pre>