On Wed, Mar 23, 2011 at 9:14 AM, Antoon Pardon
<antoon.par...@rece.vub.ac.be> wrote:
> Which isn't helpfull if where you decide how they have to be sorted is
> not the place where they are actually sorted.
>
> I have a class that is a priority queue. Elements are added at random but
> are removed highest priority first. The priority queue can have a key or
> a cmp function for deciding which item is the highest priority. It
> can also take a list as an initializor, which will then be sorted.
>
> So this list is sorted within the class but how it is sorted is decided
> outside the class. So I can't do the sort in multiple steps.

You can't do this?

for (key, reversed) in self.get_multiple_sort_keys():
    self.pq.sort(key=key, reversed=reversed)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to