is_max = s == s.max() | How should I read this?
<p>While studying <a href="http://pandas.pydata.org/pandas-docs/stable/style.html" rel="nofollow">Pandas Style</a>, I got to the following:</p>

<pre><code>def highlight_max(s):
    '''
    highlight the maximum in a Series yellow.
    '''
    is_max = s == s.max()
    return ['background-color: yellow' if v else '' for v in is_max]
</code></pre>

<p>How should I read <code>is_max = s == s.max()</code>?</p>

<p>According to the document, <a href="https://docs.python.org/3/reference/expressions.html#evaluation-order" rel="nofollow">Evaluation order</a>:</p>

<blockquote>
  <p>Notice that while evaluating an assignment, the right-hand side is
  evaluated before the left-hand side.</p>
</blockquote>

<p>This is quite reasonable, for you have to know the value of an expression before assigning it to a variable.</p>

<p>So Python first evaluates <code>s.max()</code>, followed by checking if the calculated value is equal to <code>s</code>, resulting in a boolean result, and then assign this boolean to a variable called <code>is_max</code>.</p>

<p>See also: <a href="https://docs.python.org/3/reference/simple_stmts.html#assignment-statements" rel="nofollow">Assignment statements</a></p>

python python-2.7 pandas