Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2013
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. class A(object):
  2.     def __lt__(self, rhs):
  3.         print 'A.lt'
  4.         return NotImplemented
  5.     def __gt__(self, rhs):
  6.         print 'A.gt'
  7.         return NotImplemented
  8.     def __cmp__(self, rhs):
  9.         print 'A.cmp'
  10.         return NotImplemented
  11.  
  12. class B(object):
  13.     def __lt__(self, rhs):
  14.         print 'B.lt'
  15.         return NotImplemented
  16.     def __gt__(self, rhs):
  17.         print 'B.gt'
  18.         return NotImplemented
  19.     def __cmp__(self, rhs):
  20.         print 'B.cmp'
  21.         return NotImplemented
  22.  
  23. a, b = A(), B()
  24. print a < b
  25. print cmp(a, b)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement