I am new to python. I have a few questions coming from an armature!
Christian Gollwitzer
auriocus at gmx.de
Wed Aug 17 03:26:26 EDT 2016
Am 17.08.16 um 08:39 schrieb Steven D'Aprano:
> Quote:
>
> The Python syntax for conditional expressions (introduced in Python 2.5) is
>
> trueval if cond else falseval
>
> I think this is bloody awful. Why couldn’t they have adopted the standard C
> syntax, as used in a whole bunch of other C-derivative languages?
>
> cond ? trueval : falseval
>
>
>
> Because the C syntax is horrifically ugly,
De gustibus non est disputandum.
> whereas the Python syntax is very
> close to real English syntax.
>
> "What will you do tonight?"
>
> "Go to the movies, if I finish work on time, otherwise just go home."
This is a non-sequitur. You could as well say, in English:
"If I finish work on time, I go to the movies, otherwise just go home."
In fact, that's how an if-clause looks like in Python
if work_done():
go_to_movies()
else:
go_home()
Do you also struggle reading this?
> Every time you read the C syntax, you lose another three minutes off your
> lifespan. That's how ugly it is.
It's an acquired taste. I'm not arguing that one is better than the
other - it depends on what you are used to. I can read both without
problems, but I avoid writing conditional expressions - if the
subexpressions are not very simple.
Christian
More information about the Python-list
mailing list