Skip to content

Instantly share code, notes, and snippets.

@davidthewatson
Created December 9, 2011 00:38
Show Gist options
  • Save davidthewatson/1449507 to your computer and use it in GitHub Desktop.
Save davidthewatson/1449507 to your computer and use it in GitHub Desktop.
python: set attributes in class given key value pairs
class a():
def set_attrs_in_class_given_key_value_pairs(**kwargs):
for k,v in kwargs.iteritems():
setattr(self, k, v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment