I am trying to inject a mixin to a class with a decorator. When the code runs the class no longer has a dict property even though the dir(instance) says it has one. I'm not sure where the property is disappearing. Is there a way that I can get dict or otherwise find the instance's attributes?
def testDecorator(cls): return type(cls.__name__, (Mixin,) + cls.__bases__, dict(cls.__dict__)) class Mixin: pass @testDecorator class dummyClass: def __init__(self): self.testVar1 = 'test' self.testVar2 = 3.14 inst = dummyClass() print(dir(inst)) print(inst.__dict__) This code works if the decorator is commented out yet causes an error when the decorator is present. Running on python 3.5.1