Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

method call in __init__ get its result returned to the caller #16

Open
ghost opened this Issue Jul 31, 2011 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Jul 31, 2011

I hope this example code is explicit enough

class ERROR:
    pass

class B:
    def __init__(self):
        super(B, self).__init__()
        self.build_element()

    def build_element(self):
        return ERROR('body')


def dom_ready():
    b = B()
    return b  # == ERROR()
Contributor

Neppord commented Jul 31, 2011

GJ! btw the code you wrote as an example is really broken, but since you solved it your self no need for fixing it ^^.
but for reference: super function can only be used with new style classes( which should be almost the only thing you use). New style classes all must derive from object or something that is a new style class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment