Liste des Groupes | Revenir à l misc |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:David Brown <david.brown@hesbynett.no> writes:>On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:>It’s bloody horrible Python even when wrapped correctly. I think>
Python’s version of the conditional expression is a complete
abortion.
That's probably the reason almost no one uses it. That post is the
first time I have ever seen conditional expressions outside of a brief
mention in a tutorial on Python conditionals showing how to write
normal conditionals in the language. I think Python stole this one
from Perl.
No, Perl's conditional expressions use the same syntax as C's.
>
As for whether Python's conditional expression syntax, it's not clear
that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else
expr2) (unless you happen to be familiar with one of them).
I’ve been familiar with both for years and I think the Python version is
awful; in particular the ordering is a bizarre choice. The PEP where
they worked out the design acknowledges this but then they went ahead
and did it anyway...
Les messages affichés proviennent d'usenet.