Skip to content

Instantly share code, notes, and snippets.

@eightysteele
Created August 11, 2011 04:27
Show Gist options
  • Select an option

  • Save eightysteele/1138901 to your computer and use it in GitHub Desktop.

Select an option

Save eightysteele/1138901 to your computer and use it in GitHub Desktop.
class Cell(model.Model):
"""Models a CouchDB cell document.
key_name - The cell key (e.g., 1-2).
"""
rev = model.StringProperty('r')
coords = model.StringProperty('c')
varvals = model.TextProperty('v')
def __eq__(self, other):
if isinstance(other, Cell):
return self.key() == other.key()
return NotImplemented
def __ne__(self, other):
result = self.__eq__(other)
if result is NotImplemented:
return result
return not result
def __hash__(self):
return hash(self.key().name())
def __cmp__(self, other):
return self.key().__cmp__(other.key())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment