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

alan.gauld@bt.com alan.gauld@bt.com
Tue Apr 1 08:05:02 2003

> The second problem is to implement a sorted list with the 
> following options:

It looks like a standard Python list with the twist of sorting itself 
after every addition.(Which could become slow BTW!)

You could create a class to do that either subclassing from the standard 
list or, I think thee is a UserList which is specifically designed for 
this. Then override the insert/append/assign operations to call the 
standard variant followed by a sort() call.

Alan g