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.

Author pitrou
Recipients alex, benjamin.peterson, pitrou, rhettinger
Date 2013-03-03.10:29:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362306380.3470.2.camel@localhost.localdomain>
In-reply-to <1362282521.75.0.367136904932.issue17338@psf.upfronthosting.co.za>
Content
> 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] = ...
History
Date User Action Args
2013-03-03 10:29:59pitrousetrecipients: + pitrou, rhettinger, benjamin.peterson, alex
2013-03-03 10:29:59pitroulinkissue17338 messages
2013-03-03 10:29:59pitroucreate