In article 
<CAPJVwBkLww7-ysZB76LMRZ+mmbyN_5T=ym_vu1pjgakrlbq...@mail.gmail.com>,
 Nathaniel Smith <n...@pobox.com> wrote:

> OPTION 1 FOR @:
> Precedence: same as *
> Associativity: left
> My shorthand name for it: "same-left" (yes, very creative)
> 
> This means that if you don't use parentheses, you get:
>    a @ b @ c  ->  (a @ b) @ c
>    a * b @ c  ->  (a * b) @ c
>    a @ b * c  ->  (a @ b) * c
> 
> OPTION 2 FOR @:
> Precedence: more-weakly-binding than *
> Associativity: right
> My shorthand name for it: "weak-right"
> 
> This means that if you don't use parentheses, you get:
>    a @ b @ c  ->  a @ (b @ c)
>    a * b @ c  ->  (a * b) @ c
>    a @ b * c  ->  a @ (b * c)
> 
> OPTION 3 FOR @:
> Precedence: more-tightly-binding than *
> Associativity: right
> My shorthand name for it: "tight-right"
> 
> This means that if you don't use parentheses, you get:
>    a @ b @ c  ->  a @ (b @ c)
>    a * b @ c  ->  a * (b @ c)
>    a @ b * c  ->  (a @ b) * c
> 
> We need to pick which of which options we think is best, based on whatever
> reasons we can think of, ideally more than "hmm, weak-right gives me warm
> fuzzy feelings" ;-). (In principle the other 2 possible options are
> tight-left and weak-left, but there doesn't seem to be any argument in
> favor of either, so we'll leave them out of the discussion.)

After seeing all the traffic on this thread, I am in favor of 
"same-left" because it is easiest to remember:
- It introduces no new rules.
- It is unambiguous. If we pick option 2 or 3 we have no strong reason  
to favor one over the other, leaving users to guess.

To my mind, being able to easily reason about code you are reading is 
more important that hoping to increase efficiency for one common case 
when not using parenthesis.

It also has the advantage that it needs the least justification.

-- Russell

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to