[issue1551113] random.choice(setinstance) fails
report at bugs.python.org
Fri Mar 27 06:26:33 CET 2009
Tim Peters <tim.peters at gmail.com> added the comment:
The CPython set/dict implementation does not guarantee "minimal constant
density", so "quite easy" doesn't apply in reality. For example, a set
that once contained a million elements may still contain a million
/slots/ for elements after all but one of the elements has been removed.
And in that case, the only way to find the sole occupied slot is to
search over the million allocated slots.
In short, all the comments in this item from 2006 still apply without
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list