Jim Jewett wrote: > On 3/7/06, Paul Moore <[EMAIL PROTECTED]> wrote: > > >>The parentheses around genexps were (AFAICT) >>different - without them, the grammar was ambiguous, >>so some way of disambiguating was needed. > > > The out-of-order evaluation is a very large change, > because now we have a situation where normal > parsing completes an expression, but needs to avoid > evaluating it, just in case. > > Currently, we can write: > > >>> if False: > >>> print r > >>> else: > >>> print 6 > > 6 > > >>> r > > Traceback (most recent call last): > File "<pyshell#14>", line 1, in -toplevel- > r > NameError: name 'r' is not defined > > In the above example, r doesn't get evaluated because > the if ahead of it says to skip that branch. But with > conditional expressions, that flow control is changed > from *later* in the program. > > I don't think we'll see the equivalent of Intercal Suck > Points anywhere but intentionally obfuscated code, > but I do expect to see: > > >>> side_effect() if condition > > In fact, I think the below examples are reasonable uses > that do a better job of expressing intent than the if > statement would. I just don't like the mental backtrack > they require, and would like some sort of advance > warning. Parentheses at least tell me "You're not done > yet; keep reading." > > >>> ack(r,r) if r not in cache > > >>> log(message) if error_flag > I think you've misunderstood the nature of the change. HTe new conditionals are *expressions*, they aren't postfix conditionals for statements.
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd www.holdenweb.com Love me, love my blog holdenweb.blogspot.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com