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

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

In article <3e457137_5 at>,
Samuele Pedroni <pedronis at> wrote:
>I sympathize but the question is really what you prefer your target group to
>1) sys.exit(errs and 1 or 0)
>    style = bold and "bold" or "italic"
>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           <*>

Register for PyCon now!

More information about the Python-list mailing list