For review: PEP 308 - If-then-else expression
adalke at mindspring.com
Sun Feb 9 03:37:07 CET 2003
> > > 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.
> > Huh? I would prefer neither. I would rather have
> so you they never look at the code of the libraries they use, or you
> 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.
dalke at dalkescientific.com
More information about the Python-list