title: Python: max/min builtin functions depend on parameter order
body: <p><code>max(float('nan'), 1)</code> evaluates to nan</p>
  
  <p><code>max(1, float('nan'))</code> evaluates to 1</p>
  
  <p>Is it the intended behavior?</p>
  
  <hr>
  
  <p>Thanks for the answers.</p>
  
  <p><code>max</code> raises an exception when the iterable is empty. Why wouldn't Python's <code>max</code> raise an exception when <code>nan</code> is present? Or at least do something useful, like return <code>nan</code> or ignore <code>nan</code>. The current behavior is very unsafe and seems completely unreasonable.</p>
  
  <p>I found an even more surprising consequence of this behavior, so I just posted a <a href="https://stackoverflow.com/questions/4240050/python-sort-function-breaks-in-the-presence-of-nan">related question</a>.</p>