This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: AST Optimization for Single Target List Comprehension
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, methane, pablogsal, rhettinger, vstinner
Priority: normal Keywords:

Created on 2019-11-19 12:14 by BTaskaya, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg356965 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2019-11-19 12:14
I was going through old issues and I found @inada.naoki's comment on issue 36551

> How about converting `[x for x in it]` to `[*it]` in AST?

Is this feature still wanted? I can try to work on an implementation for this if there is a need. Also should this cover set (`{x for x in it}`) comprehensions?
msg357007 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-11-19 23:57
IMHO, I think is such a specific use case that is not worth the maintenance cost. Especially because of such list comprehension is very uncommon as you can simply do `list(it)` which more readable and anecdotally faster.
msg357020 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-11-20 01:50
I concur with Pablo.

Thank you for the suggestion though.
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 83028
2019-11-20 01:50:33rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg357020

resolution: rejected
stage: resolved
2019-11-19 23:57:15pablogsalsetnosy: + pablogsal
messages: + msg357007
2019-11-19 12:15:00BTaskayasetcomponents: + Interpreter Core
versions: + Python 3.9
2019-11-19 12:14:31BTaskayasetnosy: + vstinner
2019-11-19 12:14:18BTaskayacreate