title: Why does python max('a', 5) return the string value?
body: <p>Tracing back a <code>ValueError: cannot convert float NaN to integer</code> I found out that the line:</p>
  
  <pre><code>max('a', 5)
  max(5, 'a')
  </code></pre>
  
  <p>will return <code>a</code> instead of 5.</p>
  
  <p>In the above case I used the example string <code>a</code> but in my actual case the string is a <code>NaN</code> (the result of a fitting process that failed to converge).</p>
  
  <p>What is the rationale behind this behaviour? Why doesn't python recognize automatically that there's a string there and that it should return the number?</p>
  
  <p>Even more curious is that <code>min()</code> <em>does</em> work as expected since:</p>
  
  <pre><code>min('a', 5)
  min(5, 'a')
  </code></pre>
  
  <p>returns <code>5</code>.</p>