On Fri, 14 Jul 2017 09:06 am, Ned Batchelder wrote: > Steve's summary is qualitatively right, but a little off on the quantitative > details. Lists don't resize to 2*N, they resize to ~1.125*N: > > new_allocated = (size_t)newsize + (newsize >> 3) + (newsize < 9 ? 3 : 6); > > (https://github.com/python/cpython/blob/master/Objects/listobject.c#L49-L58)
Ah, thanks for the correction. I was going off vague memories of long-ago discussion (perhaps even as long ago as Python 1.5!) when Tim Peters (I think it was) described how list overallocation worked. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list