Niklas Frykholm <r2d2 / acc.umu.se> wrote in message news:<2H5c7.21188$5j7.1812191 / e420r-atl1.usenetserver.com>... > > But, don't you think this is a weired grammar? In the following, the > > second line prints ", ", but the third prints "true": > > > > cond = 1 > > print cond == 1 ? ", " : "\n" > > print (cond == 1) ? ", " : "\n" > > > > I think this is very counter-intuitive. What's the rationale for this > > interpretation? > > There is a third example to consider > > 1: print cond == 1 ? ", " : "\n" > 2: print (cond == 1) ? ", " : "\n" > 3: print(cond==1) ? ", " : "\n" Thank you for the clear explanation! I understand the problem. This indicates, I think, that the introduction of the "operator notation" like print some, other has brought about lots of potential ambiguities. If the language banned the operator notation and allowed only the "function notation" print(some, other) then the possibility of ambiguity would be much lower. Is there a compelling reason for allowing the operator notation in spite of this problem? Personally, I don't much care about the operator notation and often use parens for clarity where they aren't necessary. (By the way, the expressions "operator notation" and "function notation" are ad hoc ones. If you know official or accepted terminology, please tell me.) > For clarity, it is probably best to always use parenthesis in the method > call when you have complex arguments: > > print( (cond==1) ? ", " : "\n" ) Agreed. Thank you again, Ryo