Python class decorator and maximum recursion depth exceeded
- by Michal Lula
I try define class decorator. I have problem with __init__ method in decorated class. If __init__ method invokes super the RuntimeError maximum recursion depth exceeded is raised.
Code example:
def decorate(cls):
class NewClass(cls): pass
return NewClass
@decorate
class Foo(object):
def __init__(self, *args, **kwargs):
super(Foo, self).__init__(*args, **kwargs)
What I doing wrong?
Thanks, Michal