On Mon, Jul 20, 2020 at 10:36 AM Rob Cliffe via Python-ideas <
python-ideas@python.org> wrote:

> May I repeat:  Spelling 'if break:' and 'if not break:' rather than say
> 'on_break:' etc. would avoid adding new keywords.
>
> I don't know what to do about the zero iterations case, though.
>

It could be that if `break` appears somewhere that an expression is
expected, it becomes an expression with the value 0 or 1 (or False or True)
to indicate the number of breaks that happened in the previous loop, and
similarly some other bit of code involving keywords can become the number
of iterations of the previous loop. This could be represented by `for`,
`len(for)`, `pass`, etc. So one might write:

```
for x in ...:
    ...
if not pass:
    ...
elif pass == 1:
    ...
else:
    ...
```
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/N65ZZJPLN6LBPQOURDKJNXWGT64T3ZZK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to