[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Write this accumuator in a functional style

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.