[New-bugs-announce] [issue41942] Add if condition for 'for loop'

chienpingtsung report at bugs.python.org
Mon Oct 5 06:33:27 EDT 2020


New submission from chienpingtsung <jianpingzong at outlook.com>:

'for loop' always been used as follow code:

arr = [...]
for e in arr:
    if not condition(e):
        continue
    ...

What if be written just like 'list expression', would it be more explicit?

for e in arr if condition(e):
    pass

----------
components: Interpreter Core
messages: 378015
nosy: chienpingtsung
priority: normal
severity: normal
status: open
title: Add if condition for 'for loop'
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41942>
_______________________________________


More information about the New-bugs-announce mailing list