Run
MyClass = type('MyClass', (object,), {'x': 42}) obj = MyClass() print(obj.x)
Output