On Sep 10, 9:16 am, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
> John Machin wrote:
> > On Sep 10, 8:05 am, Lee Harr <[EMAIL PROTECTED]> wrote:
> >>>> Python will always yield a number x = m%n such that 0 <= x < n, but
> >>>> Turbo C will always yield a number such that if x = m%n -x = -m%n.  That
> >>>> is, since 111 % 10 = 1, -111 % 10 = -1.  The two values will always
> >>>> differ by n (as used above).
> >> Maybe it is an order-of-operations thing....
>
> >> -111 % 10 = -1
> >> (-111) % 10 = 9
> >> ?
>
> > and on the other hand, maybe it's not. Try to think of any language
> > where unary minus binds so loosely.
>
> Why the theoretical argument when you can TEST your assumptions?
>
> >>> -111 % 10
> 9
> >>> (-111) % 10
>
> 9

I was *assuming* nothing; I *know* what is the relative precedence of
% and unary minus in both C and Python. I was not arguing; I was
inviting Lee (as I now invite you) to think before writing.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to