Skip to content

Instantly share code, notes, and snippets.

@yloiseau
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yloiseau/beda986203f5b1f26573 to your computer and use it in GitHub Desktop.
Save yloiseau/beda986203f5b1f26573 to your computer and use it in GitHub Desktop.
class Human:
def __init__(self, **kargs):
object.__setattr__(self, '_fields', kargs)
def __setattr__(self, name, value):
self._fields[name] = value
def __getattr__(self, name):
return self._fields.get(name, None)
bob = Human(firstName="Bob", lastName="Morane")
print(bob.firstName + " " + bob.lastName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment