Defending the ternary operator

Aahz aahz at pythoncraft.com
Sat Feb 8 23:32:54 CET 2003


In article <yu991y2iae1a.fsf at europa.research.att.com>,
Andrew Koenig  <ark at research.att.com> wrote:
>
>Alexander> I think you're missing one important aspect:
>Alexander> predicatability of the sort that syntatic uniformity buys
>Alexander> you. That is because it allows you to parse larger chunks,
>Alexander> e.g. you always know that when you run into the token "if"
>Alexander> the context is as follows: ``if CONDITION: DO_SOMETHING
>Alexander> ...``.
>
>This claim is already not true:
>
>        y = [i for i in x if i != 0]

That's a limited counter-claim because of the brackets setting off the
listcomp.  It's also further limited by the functionality available to
the if.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Register for PyCon now!  http://www.python.org/pycon/reg.html




More information about the Python-list mailing list