title: Python ConfigParser use defaults if not in configuration file
body: <p>What's the best way to use a default value if it isn't defined in a configuration file?  E.g. in the example below, perhaps only <code>listen_address</code> is defined in the configuration, and <code>listen_port</code> is absent.</p>
  
  <p>I'm trying something like this:</p>
  
  <pre><code>import ConfigParser
  from os.path import isfile
  
  if __name__ == "__main__":
  
      # Set default values
      listen_address = '127.0.0.1'
      listen_port = 8000
  
      # Check for configurations from file and override defaults
      configFile = './configuration.ini'
      if isfile(configFile):
          configs = ConfigParser.ConfigParser()
          configs.read(configFile)
          try:
              listen_address = configs.get('ServerConfigs', 'listen_address')
          except:
              pass
          try:
              listen_port = configs.get('ServerConfigs', 'listen_port')
          except:
              pass
  </code></pre>
  
  <p>But that feels ugly.</p>