[Python-ideas] Length hinting and preallocation for container types

Serhiy Storchaka storchaka at gmail.com
Thu Mar 7 15:30:20 CET 2013

On 05.03.13 21:50, Ethan Furman wrote:
> I suspect the new behavior would be most useful when you don't know
> precisely how large the final list will be: overallocate (possibly by a
> large margin), then __exit__ returns the unused portion back to the pool).

A list comprehension can do this.

More information about the Python-ideas mailing list