memory allocation for Python list

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Mar 26 18:26:52 EDT 2008


dmitrey:
> As I have mentioned, I don't know final length of the list, but
> usually I know a good approximation, for example 400.

You may want to use collections.deque too, it doesn't produce a Python
list, but it's quite fast in appending (it's a linked list of small
arrays).

Bye,
bearophile



More information about the Python-list mailing list