For review: PEP 308 - If-then-else expression

Aahz aahz at pythoncraft.com
Sun Feb 9 00:08:32 CET 2003


In article <3e457137_5 at news.bluewin.ch>,
Samuele Pedroni <pedronis at bluewin.ch> wrote:
>
>I sympathize but the question is really what you prefer your target group to
>encounter:
>
>1) sys.exit(errs and 1 or 0)
>    style = bold and "bold" or "italic"
>
>or
>
>2) sys.exit(1 if errs else 0)
>    style = "bold" if  bold else "italic"
>
>because (1) idioms are used in practice.

None of the above.  If the ternary becomes part of Python, any group that
I have any control over would use neither of the sys.exit versions, and
the more I look at the conditional in the middle, the more I abhor it.
-- 
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