[Tutor] Re: how to do a (special) sorted list

Adam Groszer adamg@mailbox.hu
Tue Apr 1 10:50:04 2003


What should I do when I have to delete an item?
Simply issue list.remove(item) or are there some faster things?

Adam

-----Original Message-----
[snip]
>Then override the insert/append/assign operations to call the
> standard variant followed by a sort() call.
[snip]
Check out the 'bisect' module. It contains functions that can insert items
in a list in such a way as to maintain sorted order.
[snip]