Liste des Groupes | Revenir à l misc |
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).
Les messages affichés proviennent d'usenet.