New submission from catrudis <ar12...@gmail.com>:

ELSE-clause in FOR and WHILE has unclear syntax. I suggest new clause instead:

if COND:
  ...
[elif COND:
  ...]
[else:
  ...]

This IF-clause like must be immediately after FOR- or WHILE-cycle (only comment 
allowed between). It looks like a regular IF, but COND is special.
COND may be "break", "pass" or "finally". "if break:" - if used break-operator 
to exit cycle. "if pass:" - cycle executed 0 times. "if finally:" - cycle 
executed 0 or more times ("pass-case"  is included in "finally-case"). For 
compatibility only "else:" means "if finally:".
It's compatible enhancement. No new keyword. There can be no combination 
"break", "pass" or "finally" after "if"/"elif:" in current version.

----------
components: Interpreter Core
messages: 373479
nosy: catrudis
priority: normal
severity: normal
status: open
title: New clause in FOR and WHILE instead of ELSE
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41272>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to