On 07/27/2019 01:19 AM, Serhiy Storchaka wrote:
26.07.19 23:57, Guido van Rossum пише:
However, I worry that when people see this syntax, they will think that the except clause is for handling exceptions in the loop body. (That's certainly what I assumed when I read just your subject line. :-)
And it's what I thought when I saw the psuedo-code.
I think people can make a mistake only when they see it for the first time. After you learn what this syntax means, you will not make this mistake the second time. The same applies to any other syntactic construction.
Sorry, but that mistake will be made many, many times by the same people. It's
taken me several years to sort out for...else
, and even now I have to think
"it's a search loop, adapt your algorithm".
Another classic example is allowing single-"=" assignment in tests:
if some_var = 7: ...
Sure, folks /know/ what it means, but it's a common bug because it doesn't read as "if some_var is assigned 7" but as "if some_var is equal to 7".
-- ~Ethan~