Skip to content

Instantly share code, notes, and snippets.

@nutjob4life
Created July 19, 2013 14:11
Show Gist options
  • Save nutjob4life/6039391 to your computer and use it in GitHub Desktop.
Save nutjob4life/6039391 to your computer and use it in GitHub Desktop.
class X(object):
def __init__(self, value):
self.value = value
def __cmp__(self, other):
print 'I am %x, comparing my %d with other %x %d' % (id(self), self.value, id(other), other.value)
return cmp(self.value, other.value)
a = [X(2), X(1), X(3)]
X(1) in a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment