Message339618
| Author | anthony shaw |
|---|---|
| Recipients | Aaron Hall, anthony shaw, methane, ncoghlan, ronaldoussoren, serhiy.storchaka |
| Date | 2019-04-08.11:35:08 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1554723308.57.0.650015281311.issue36551@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
> How about converting `[x for x in it]` to `[*it]` in AST?
I should have been more explicit, this patch improves the performance of all list comprehensions that don’t have an if clause.
Not just
[x for x in y]
but:
d = {} # some sort of dictionary
[f”{k} — {v}” for k, v in d.items()]
a = iterable
[val**2 for val in a]
Would all use BUILD_LIST_PREALLOC and use a LengthHint.
I can do another speed test for those other scenarios.
Most of the stdlib packages have these sorts of list comps, including those in the default site.py. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-04-08 11:35:08 | anthony shaw | set | recipients: + anthony shaw, ronaldoussoren, ncoghlan, methane, serhiy.storchaka, Aaron Hall |
| 2019-04-08 11:35:08 | anthony shaw | set | messageid: <1554723308.57.0.650015281311.issue36551@roundup.psfhosted.org> |
| 2019-04-08 11:35:08 | anthony shaw | link | issue36551 messages |
| 2019-04-08 11:35:08 | anthony shaw | create | |