anthony shaw <anthony.p.s...@gmail.com> added the comment: > 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. ---------- nosy: -pablogsal _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36551> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com