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

Antoine Pitrou solipsis at pitrou.net
Fri Mar 8 14:35:39 CET 2013

Le Fri, 8 Mar 2013 08:18:07 -0500,
Daniel Holth <dholth at gmail.com> a écrit :
> I am a fan of the proposal. Imagine you are programming for a
> memory-constrained system. By telling the list how big it needs to be
> you can save precious RAM.

Is it an actual use case or are you just imagining it? :)
I'm asking because, unless you are only allocating that list and all
the objects contained it in it already exist, limiting the list's size
won't do much for the process' memory occupation.



More information about the Python-ideas mailing list