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

Samuele Pedroni pedronis at bluewin.ch
Sat Feb 8 17:26:56 EST 2003


"Andrew Koenig" <ark at research.att.com> ha scritto nel messaggio
news:yu99d6m277bw.fsf at europa.research.att.com...
> Samuele> I sympathize but the question is really what you prefer your
> Samuele> target group to encounter:
>
> Samuele> 1) sys.exit(errs and 1 or 0)
> Samuele>     style = bold and "bold" or "italic"
>
> Samuele> or
>
> Samuele> 2) sys.exit(1 if errs else 0)
> Samuele>     style = "bold" if  bold else "italic"
>
> Samuele> because (1) idioms are used in practice.
>
> If (1) and (2) were equivalent, I wouldn't care.  But the trouble comes
> in stuff like this:
>
>                 sys.exit(ok and 0 or errcode)
>
> which, at first glance, appears analogous to (1), but really means
>
>                 sys.exit(errcode)

If you repeat this argument another time, I'm gonna scream.

And you are overgeneralizing my samples.






More information about the Python-list mailing list