Need customised sort
Bengt Richter
bokr at oz.net
Sat Apr 13 17:24:12 EDT 2002
On Sat, 13 Apr 2002 12:19:35 -0700, bvdpoel at uniserve.com wrote:
>
>Yeah, I thought this would be easy...
>
>I have a list like this:
>
> [ [0, x, [0, y, [4, n] ...]
>
Is this what it appears to be? I.e., a linked list of [offset,event,link]
rooted in a [] ? Thus:
[ + ]
|
+[0, x, +]
|
+[0, y, +]
|
+[4, n *?*]
(*?* what goes here, or are you using len(element)<3 to indicate eol?)
If it is a linked list, do you need that for fast insertions on the fly, or what?
If not, why not [ [0,x], [0,y], [4,n] ...] or [ (0,x), (0,y), (4,n) ...] ?
The sorting is going to be different, depending ;-)
BTW, is there no cheap way to maintain desired order as you build/modify the list,
so you won't need a sort per se?
Regards,
Bengt Richter
More information about the Python-list
mailing list