Self reordering list in Python
Thomas Guettler
niemand.leermann at thomas-guettler.de
Thu Sep 15 11:00:39 EDT 2005
Am Thu, 15 Sep 2005 15:14:09 +0200 schrieb Laszlo Zsolt Nagy:
>
> Hello,
>
> Do you know how to implement a really efficient self reordering list in
> Python? (List with a maximum length. When an item is processed, it
> becomes the first element in the list.) I would like to use this for
> caching of rendered images. Of course I could implement this in pure
> Python, I just wonder if there is a faster implementation that uses some
> cool feature of the standard library. (Maybe a C implementation could be
> added to the collections module?)
Hi,
Maybe the bisect module is what you need:
"This module provides support for maintaining a list in sorted order
without having to sort the list after each insertion."
HTH,
Thomas
--
Thomas Güttler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: niemand.leermann at thomas-guettler.de
More information about the Python-list
mailing list