For review: PEP 308 - If-then-else expression
phr-n2003b at NOSPAMnightsong.com
Sun Feb 9 09:34:04 CET 2003
Erik Max Francis <max at alcyone.com> writes:
> A strict analysis of how frequently a construct will be used shouldn't
> be the sole deciding factor in whether or not it gets introduced into
> the language.
Certainly not the sole factor, but it does have some relevance. I
don't know whether analyzing already-written code is the right way to
measure it either.
I find on a fairly regular basis that I get annoyed by not having a
conditional expression in Python. Maybe it happens once ever few
weeks of coding. That's enough to notice, and to be supportive of
efforts to add it. It's like if I get a telemarketing phone call
every few weeks--it's not a night and day source of agony, but it
would be nice to be able to get it to stop.
I'd say every time I write code with regexps, I want an assignment
while (m := re.match(exp, something)): ...
so if I could add just one construct, assignment expressions or
conditional expressions, I'd probably take assignment expressions even
though they don't do as much from a functional programming point of
I'm not a coding robot or lumberjack-style coder. I like to enjoy
myself when I code, and to massage code around til it looks nice on
the screen. It's like eating potato chips one after another. Hitting
some silly limitation of the language is like getting a potato chip
that tastes terrible. If every 500th potato chip has some awful taste
that makes you go "ptui", it messes up your enjoyment of the other 499.
It's a separate issue from whether you need all 500 for nourishment.
More information about the Python-list