Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Open

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

ghost opened this issue Jul 31, 2011 · 1 comment

Comments

@ghost
Copy link

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()
@Neppord
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant