Skip to content

Instantly share code, notes, and snippets.

@jvorcak
Created September 4, 2014 14:24
Show Gist options
  • Save jvorcak/108314398eae466f384d to your computer and use it in GitHub Desktop.
Save jvorcak/108314398eae466f384d to your computer and use it in GitHub Desktop.
Automatically set attributes in a class
class User(object):
def __init__(self, **kwargs):
self.name = None
self.__dict__.update(kwargs)
u = User(name="Jan")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment