STINNER Victor <[email protected]> added the comment:
> I believe this was implemented in issue33234
I don't think so. The bytecode in Python 3.9 still uses "BUILD_LIST 0":
Python 3.9.0a4+ (heads/daemon_thread_runtime2-dirty:48652767d5, Mar 7 2020,
00:56:07)
>>> def f():
... for i in range(10000):
... [j for j in range(10000)]
...
>>> import dis; dis.dis(f)
(...)
Disassembly of <code object <listcomp> at 0x7ffab2c9fd40, file "<stdin>", line
3>:
3 0 BUILD_LIST 0
2 LOAD_FAST 0 (.0)
>> 4 FOR_ITER 8 (to 14)
6 STORE_FAST 1 (j)
8 LOAD_FAST 1 (j)
10 LIST_APPEND 2
12 JUMP_ABSOLUTE 4
>> 14 RETURN_VALUE
----------
resolution: fixed ->
status: closed -> open
superseder: Improve list() pre-sizing for inputs with known lengths ->
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue14126>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com