a *= b not equivalent to a = a*b

Chris Angelico rosuav at gmail.com
Fri Aug 26 02:51:40 EDT 2016


On Fri, Aug 26, 2016 at 4:40 PM,  <mlzarathustra at gmail.com> wrote:
> Precedence, d'oh!
>
>         rs *= (n-(i-1))/i
> is equivalent to:
>         rs = rs * ((n-(i-1))/i)
>
> not
>         rs = rs * (n-(i-1))/i
>
> which is the same as
>         rs = ( rs * (n-(i-1)) )  /i
>
>
> Ken Iverson was right. Precedence is a bad idea.

No, precedence is not a bad idea. Making assumptions based on a lack
of precedence, now, that's a bad idea. But the problem is the
assumption :)

ChrisA



More information about the Python-list mailing list