title: Python equivalent of getOrElse
body: <p>In languages with optional types, you have a fn called <code>orElse</code> or <code>getOrElse</code> which lets you do this:</p>
  
  <pre><code>None.getOrElse(1) == 1
  Some(2).getOrElse(1) == 2
  </code></pre>
  
  <p>I.e. you can specify a default value. In Python, I find I am writing: </p>
  
  <pre><code>if output_directory:
      path = output_directory
  else:
      path = '.'
  </code></pre>
  
  <p>and it would be cleaner with a <code>getOrElse</code> call. Searching for orElse and getOrElse turns up logical operators. Is there a suitable Python fn?</p>
  
  <p>Edit: getOrElse is not the same as a ternary operator call because that requires you to reference <code>output_directory</code> <em>twice</em>. Which is a particular issue if it's replaced with a complex expression. (Quite normal in a functional style.)</p>