Sometimes i need to create an anonymous class instance in python, just like c#:
var o= new {attr1=\"somehing\", attr2=344};
but in python i
If you are using Python 3.3 or later, you can use types.SimpleNamespace:
from types import SimpleNamespace o = SimpleNamespace(attr1="something", attr2=344) print(o) # namespace(attr1='something', attr2=344)