[Python-ideas] Control Flow - Never Executed Loop Body

Sven R. Kunze srkunze at mail.de
Wed Mar 23 17:29:12 EDT 2016


On 23.03.2016 20:06, Joao S. O. Bueno wrote:
> As for adding different syntax for [empty use-case],
> I am +0
>
> For the idea of adding "except"  clauses to
> 'with', 'for'  and 'while' (along with a "EmptyIteration" exception)
> I am + 0.5

So it seems, you consider a new keyword for the sole purpose of 
"discovering never executed" less worthwhile than the "except" alternative.

What is the reason for this? The potential extensibility? Readability?

Btw. I can understand and confirm that the "ifempty" use-case is not as 
frequent as the length of this thread suggests. So, I would not mind a 
slightly longer syntax ("except EmptyIteration") as long as it handles 
ALL corner cases correctly. This actually is my main driver here.

I know that there are two or three easy patterns that fail in some 
cases. If a new syntax would be proposed that cannot handle all of them, 
it's not worth it. However, the frequency by which people here and on 
python-list suggest not-always working solutions still gives me a reason 
to work on this.

Best,
Sven


More information about the Python-ideas mailing list