Antoine Pitrou added the comment: > There's an obvious need for this, CPython uses optimizations like this > internally, as does PyPy.
I don't know if it's a need or if it's just "nice to have". By the way, in the list case it also makes C code simpler, since once the list is preallocated you just have to call PyList_SET_ITEM to populate it, and there's no error return to worry about. Also, lists are easy to pre-allocate in pure Python as well: l = [None] * N # populate for i in range(N): l[i] = ... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17338> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com