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

Samuele Pedroni pedronis at bluewin.ch
Mon Feb 10 06:17:18 CET 2003


"Erik Max Francis" <max at alcyone.com> ha scritto nel messaggio
news:3E473696.87B0E92B at alcyone.com...
> Paul Rubin wrote:
>
> > "Samuele Pedroni" <pedronis at bluewin.ch> writes:
> >
> > > I still prefer
> > >
> > > log.info(ok and "success!" or "failure.")
> > >
> > > over
> > >
> > > log.info(if ok: "success!" else: "failure")
> >
> > OK, at that point it just get down to a matter of subjective
> > preference.  I personally find the second version far more explicit
> > and understandable.
>
> I think this is a lot more than just preference.  To those not familiar
> with the idiom, `C and x or y' is downright obtuse.  He may prefer it
> because it is a few characters shorter (and only a _few_ at that),

no I find it less line-noisy.







More information about the Python-list mailing list