sorting question

Ksenia Marasanova ksenia.marasanova at gmail.com
Wed Aug 10 08:33:15 EDT 2005


2005/8/10, Peter Otten <__peter__ at web.de>:
> I think you cannot get away with your first rule, but have to operate on the
> full path instead. Otherwise the position of inner nodes would sometimes be
> determined by their url and sometimes by their ord_number *during* *the*
> *same* *sort*.


Rrr.. of course, you're right! Thanks.

Your code works great, I only made one slightly change:

    def get_key(self):
        return [(node.id, node.ord_number) for node in self.get_path()]

Because of errors in my tree some siblings has the same ord_number.

-- 
Ksenia



More information about the Python-list mailing list