[issue41272] New clause in FOR and WHILE instead of ELSE
Vedran Čačić
report at bugs.python.org
Sun Jul 19 01:27:02 EDT 2020
Vedran Čačić <vedgar at gmail.com> added the comment:
I completely agree that we should reject this, but you commit a very frequent mistake in programming try-expressions. The problem is, if the first option contains a NameError, second option will be executed.
It should be:
try: i001
except NameError: <loop never executed>
else: <loop executed at least once>
And similarly for break001. You see, dependent `else` is needed sometimes. But of course Guido already covered this. :-)
----------
nosy: +veky
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41272>
_______________________________________
More information about the Python-bugs-list
mailing list