[Python-Dev] When do sets shrink?
Noam Raphael
noamraph at gmail.com
Thu Dec 29 01:23:31 CET 2005
On 12/29/05, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
> What could be done is to add a test for excess dummy entries and trigger
> a periodic resize operation. That would make the memory available for
> other parts of the currently running script and possibly available for
> the O/S.
>
> The downside is slowing down a fine-grained operation like pop(). For
> dictionaries, this wasn't considered worth it. For sets, I made the
> same design decision. It wasn't an accident. I don't plan on changing
> that decision unless we find a body of real world code that would be
> better-off with more frequent re-sizing.
The computer scientist in me prefers O() terms over changes in a
constant factor, but that's only me. Perhaps a note about it should be
added to the documentation, though?
Noam
More information about the Python-Dev
mailing list