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

Andrew Dalke adalke at mindspring.com
Sun Feb 9 03:37:07 CET 2003


Samuele Pedroni
> > > I sympathize but the question is really what you prefer your target
> > > group toencounter:
> > > 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.

Me:
> > Huh?  I would prefer neither.  I would rather have

Samule:
> so you they never look at the code of the libraries they use, or you
dictate
> the style of all of them?

Ahh, I see your question.  My answer is still that I would
prefer "neither" and I can tell them "no, that isn't very good code
and you shouldn't do it either way"

But that's okay because option 1 requires too much thought
for most people to write instinctively.

I honestly haven't seen any code in my domain which (mis)used
and/or in this way.  And rarely seen it in code outside my domain.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list