Python class decorator and maximum recursion depth exceeded
Posted
by Michal Lula
on Stack Overflow
See other posts from Stack Overflow
or by Michal Lula
Published on 2010-06-09T12:57:34Z
Indexed on
2010/06/09
13:42 UTC
Read the original article
Hit count: 365
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
© Stack Overflow or respective owner