1 > 0 == True -> False

Rustom Mody rustompmody at gmail.com
Thu Jan 30 22:33:53 EST 2014


On Friday, January 31, 2014 12:23:42 AM UTC+5:30, Roy Smith wrote:
> On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote:
> > On Thu, 30 Jan 2014 09:08:58 -0500, Roy Smith wrote:
> > > 1) Assume that you don't have the full operator precedence table
> > > memorized and just parenthesize everything.
> > Oh really? Do you actually write stuff like this?
> > b = ((2*a) + 1)

> Well, OK, I exaggerated a bit.  Multiplication binds stronger than addition 
> in any language I've ever used, so I assume I know that one.  But not much 
> beyond that.

Not in APL. And horners rule is one touted advantage of that

  ax³ + bx² + cx + d
= d + xc + x²b + x³a
= d + x(c + xb + x²a)
= d + x(c + x(b + xa)

Now APL by precedence rules
- add and multiply are same precedence
- multiply denoted with ×
- all grouping right to left

We have last equal to
 d + x×c + x×b + x×a 


> > if (b >= (-1)):


> No, I wouldn't use either set of parens their either.  But, if I have any doubt at all, I rather than look it up, I just put parens.  And my threshold for doubt is pretty low.


APL:  b ≥ ¯1
ie ¯ is part of the constant and - is not ad-hoc overloaded

I wont talk of the if because that will spoil the fun
And this is a unicode experiment!



More information about the Python-list mailing list