I have a list of objects that generate code.  Some
of them depend on others being listed first, to 
satisfy dependencies of others.

I wrote a cmp function something like this:

def dep_cmp(ob1, ob2):
        
        if ob1.name in ob2.deps:
                return -1
        else:
                return 1

I also tried returning 0 when there were no dependency
relationships between the objects.

This failed, because every object was not compared with
ever other.  I imagine that this is because sort assumes
that if a > b and b > c, then a > c.  In my case, this
isn't really true.  If a is not dependent on b, and
b is not dependent on c, that doesn't mean that a is not
dependent on c.

Is there a better way?

Thanks

Tobiah
** Posted from http://www.teranews.com **
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to