Builtin function versus new syntax for PEP308 -- was Re: PEP308: Yet another syntax proposal

Andrew Koenig ark at research.att.com
Wed Feb 12 19:18:18 EST 2003


Michael> It's bad form to JUST have side-effects in a short-circuiting
Michael> expression.  So, if I saw this (with ANY of the proposed
Michael> syntaxes):

Michael>     if a>b: doActionForA() else: doActionForB()

Michael> I'd probably suggest a re-write. It's syntactically valid,
Michael> but ought to be written as an if STATEMENT not an if
Michael> EXPRESSION.

Of course, if you're serious about factoring, you should do it this way:

        (if a>b: doActionforA else: doActionforB)()

<0.5 wink>

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list