Skip to content Skip to sidebar Skip to footer

Maximum Recursion Depth Error With Getattr

I have this code; class NumberDescriptor(object): def __get__(self, instance, owner): name = (hasattr(self, 'name') and self.name) if not name: name

Solution 1:

The getattr() call is calling your __get__.

One way to work around this is to explicitly call through the superclass, object:

object.__getattribute__(instance, name)

Or, clearer:

instance.__dict__[name]

Post a Comment for "Maximum Recursion Depth Error With Getattr"