We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This leads to a bit of weirdness where you have to call self.post_init() and pass self as the first argument.
self.post_init()
self
Per Andy's comments, here is how it currently works:
>>> class a(object): ... pass ...⋅ >>> def foo(self): ... self.a = 5 ...⋅ >>> b = a() >>> b.hello = foo >>> b.hello() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() takes exactly 1 argument (0 given) >>> b.hello(b) >>> b.a 5
And here is how it could work:
>>> class a(object): ... pass ...⋅ >>> def foo(self): ... self.a = 5 ...⋅ >>> b = a() >>> import types >>> b.hello = types.MethodType(foo, b) >>> b.hello() >>> b.a 5
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This leads to a bit of weirdness where you have to call
self.post_init()
and passself
as the first argument.Per Andy's comments, here is how it currently works:
And here is how it could work:
The text was updated successfully, but these errors were encountered: