By #1 "should" be a 1-liner, I mean that I think a reasonable goal is to have a
good syntax for this operation to be one line.
And for #3 I'm basing it also off Pep 8: "Compound statements (multiple
statements on the same line) are generally discouraged."
Given that the proposed alternative isn't currently valid and #1 isn't 'bad' in
any way other than being an extra line, I can understand not wanting to move
this forward.
One last thing to consider is how this would work with filtering:
```
f(item) for item in lst if g(item)
```
saves even more space, as the #1 alternative would be
```
for item in lst:
if g(item):
f(item)
```
However this advantage doesn't apply to if/else as the syntax becomes ambiguous:
```
f(item) for item in lst if g else h
# could mean:
[f(item) for item in lst] if g else h
# or
[f(item) for item in lst if g else h]
```
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/BSALZNYSBZRUDDIFXRHFXGQ3B4V64ZFQ/
Code of Conduct: http://python.org/psf/codeofconduct/