Re: Data structure recommendation?

2008-04-07 Thread Charles Mason
If you can imply a partial order on your ranges then you can get O(n lg n) random access using a heap data structure. You'll have to implement your own heap, but heap search is easy to implement (it's Heapify that might require a little thinking). This will only work, of course, if your ranges ar

Re: Is there an official way to add methods to an instance?

2008-04-04 Thread Charles Mason
And for such a behavior they've termed "monkeying" Thus, the coinage "Monkeypatching" for what you want to do: http://mail.python.org/pipermail/python-dev/2008-January/076194.html There are a group of people who think "monkeypatching is destroying ruby." You still probably should avoid it for p