Skip to content

Instantly share code, notes, and snippets.

@alvesjnr
Created May 21, 2012 08:15
Show Gist options
  • Save alvesjnr/2761130 to your computer and use it in GitHub Desktop.
Save alvesjnr/2761130 to your computer and use it in GitHub Desktop.
class Obj:
def _validate(self):
raise NotImplemented("The object %s has not an implemented validation function." % self)
def dump(self):
return {} #some valid dictionary
@classmethod
def load1(cls, dct):
o = cls()
#do what need to do with o
return o
@staticmethod
def load2(dct):
o = Obj()
#do what need to do with o
return o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment