Delattr On Class Instance Produces Unexpected Attributeerror
I have the following abstract base class for configuration implementation (cut short): class Config(): ''' Configuration file binding ''' def __init__(self, path
Solution 1:
When defining the subclass __Sysconfig(Config)
, python obviously binds the attributes to the class. The instance self
can access them, but not delete them.
Changing delattr(self, field)
to delattr(self.__class__, field)
did the trick!
Post a Comment for "Delattr On Class Instance Produces Unexpected Attributeerror"