Dnia Sun, 10 Aug 2008 20:26:51 +0200, WP napisa�(a):

Hi,

> Hello, here are some new things I've problems with. I've made a program 
...

>      def __cmp__(self, other):
>          print "in __cmp__"
>          return self.score >= other.score

Check this out: http://docs.python.org/ref/customization.html

Definition of this method should rather look like this:
==========================================
      def __cmp__(self, other):
          print "in __cmp__"
          if self.score == other.score:
             return 0
          elif self.score > other.score:
             return 1
          return -1
==========================================

Should work fine now.

-- 
Regards,
Wojtek Walczak,
http://www.stud.umk.pl/~wojtekwa/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to