From b1377f317e4121bd00c86e55265d813bc211153d Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Mon, 26 Jul 2004 21:44:21 +0000 Subject: [PATCH] better cmp operator for Tasks --- direct/src/task/Task.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 79ee7c5c22..e5a5576274 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -87,12 +87,10 @@ class Task: # If the wakeTimes happen to be the same, just # sort them based on id else: - return cmp(self.id, other.id) - # Not sure what to do here, I guess we should just make sure it is - # not equal since it cannot be. Should it be less than or greater - # than? Not sure anybody will care. + return cmp(id(self), id(other)) + # This is important for people doing a (task != None) and such. else: - return -1 + return cmp(id(self), id(other)) # According to the Python manual (3.3.1), if you define a cmp operator # you should also define a hash operator or your objects will not be