You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromobsubimporteventclassFoo(object):
@eventdefbar(this, self):
pass@eventdefbaz(self, instance):
passfoo=Foo()
foo.bar(1) # works finefoo.bar(self=1) # TypeErrorFoo.baz(foo, 1) # works fineFoo.baz(foo, instance=1) # TypeError
The reason for this behaviour is obvious: obsub uses normal python arguments named instance and self in the wrapper functions, because python syntax doesn't allow for positional-only parameters. The fix is easy: make the signature of those functions (*args, **kwargs) and extract the self/instance parameter as the first parameter from *args.
The text was updated successfully, but these errors were encountered:
Consider the following example:
The reason for this behaviour is obvious: obsub uses normal python arguments named
instance
andself
in the wrapper functions, because python syntax doesn't allow for positional-only parameters. The fix is easy: make the signature of those functions(*args, **kwargs)
and extract theself
/instance
parameter as the first parameter from*args
.The text was updated successfully, but these errors were encountered: