Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
dynamic object in Python via type()
o = type('anonymous', (object,), {'attr_1': 'value_1', 'attr_2': 'value_2'})
print o.attr_1, o.attr_2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment