Write this accumuator in a functional style

Pavol Lisy pavol.lisy at gmail.com
Thu Jul 13 10:59:21 EDT 2017


On 7/13/17, Steve D'Aprano <steve+python at pearwood.info> wrote:

> [1] Actually, CPython's lists initially quadruple the size of the array, up
> to a
> certain point, and then switch to doubling. This ensures that small lists
> have
> even fewer expensive resizes, at the cost of wasting a bit more memory, but
> its
> only a small array so who cares?

IMHO problem is doubling size for huge lists.

Or waste big memory for huge frozensets. I mean resize it to 2*N if
its size is just N+1.



More information about the Python-list mailing list