seeking deeper (language theory) reason behind Python design choice
Marko Rauhamaa
marko at pacujo.net
Thu May 10 04:09:39 EDT 2018
bartc <bc at freeuk.com>:
> On 09/05/2018 06:44, Steven D'Aprano wrote:
>> But by the time 1.4 came around, Guido had settled on a clean separation
>> between statements and expressions as part of Python's design.
>>
>> That separation has gradually weakened over the years,
>
> Presumably it's non-existent now, as it seems you can type any
> expression as a statement in its own right:
>
> "stmt"
> a + b*c
> p == 0
When typing in code (in various languages), I have a habit of typing
"..." at places that need to be implemented. For example:
if count:
...
else:
do_something_smart()
break
the idea being that "..." will surely trigger a syntax error if I forget
to address it.
I was mildly amused when Python happily executed such code. "..." is a
valid expression and thus, a valid statement.
Marko
More information about the Python-list
mailing list