For review: PEP 308 - If-then-else expression
pedronis at bluewin.ch
Sat Feb 8 22:00:27 CET 2003
"Andrew Dalke" <adalke at mindspring.com> ha scritto nel messaggio
news:b23lug$1rs$1 at slb6.atl.mindspring.net...
> Dale Strickland-Clark:
> > I really don't have much sympathy for that argument. If you want to
> > understand a language, you will need to know it.
> > You can't expect to pick up a few basic terms and hope to understand
> > everything.
> I promote Python for computational biologists and chemists. These
> are people who use computers for their job,and do a bit of programming,
> but do not generally consider themselves to be programmers.
> I promote Python because it's a language which is easy to use and
> understand by a broad range of people. Scientists can start using
> it with little effort, PRECISELY BECAUSE they need only to pick
> up a few basic terms and can hope to understand everything.
> And yet Python is also enjoyed by expert programmers, because
> it is a very powerful and expressive language. This means that
> as a scientist gets more and more proficient at Python and writes
> more and more complex programs, there is no need to switch to
> another langauge to get more expressive power. It also means that
> code written by the scientist can (realtively easily) be integrated into
> the main codebase developed by the software team. And it means
> the software developers can more easily help a scientist with a bit
> of tricky code.
> The more and more complex Python gets, the harder it is for people
> who don't want to be software developers to learn how to use it.
> In the lab, code gets swapped around, and passes on through
> several generations of grad students and postdocs. It is GOOD
> that there is only a limited vocabulary from which to draw. Otherwise
> is becomes harder and harder to figure out someone else's code,
> especially since the people I'm talking about don't want to learn
> the whole gamut of the language and prefer to stick to a subset of
> terms which gets things done. This leads to dialects and leads to
> a lack of the ability to share code and learn from others.
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.
Personally I have no problem with (1) idioms and I don't like (2) forms, or
more in general I have yet to see a ternary cond op form that I like.
So I'm happy with the status quo, workarounds included and their
But I don't know if you share/can share that position.
More information about the Python-list