Creating a list with holes
Dan Stromberg
drsalists at gmail.com
Fri Jan 3 21:58:21 EST 2014
On Fri, Jan 3, 2014 at 7:37 AM, Chris Angelico <rosuav at gmail.com> wrote:
> Depending on what exactly you need, it's probably worth just using a
> dict. In what ways do you need it to function as a list? You can
> always iterate over sorted(some_dict.keys()) if you need to run
> through them in order.
FWIW, sorting inside a loop is rarely a good idea, unless your lists
are pretty small.
For that, there are many tree datastructures available.
More information about the Python-list
mailing list