Replies: 1 comment 1 reply
-
One way could be to have a class A registering like this would for instance cause that the callable
The arguments that are passed to
Implementation could be done via wrapping (this is just pseudocode not ironed out potential issues): class CallableMixin:
def register_callable(self, method_name:str, callable:Callable):
method = self.getattr(method_name)
@functools.wraps(method)
def wraps(self, *args, **kwards):
attribs = get_fields(self) #pseudocode
my_callable(*args, **kwargs, **attribs)
return method(self, *args, *kwargs)
self.setattr(method_name, wraps) This would
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lets discuss some possible mechanism for implementing a general mechanism to inject callables. This is eg realted to #215 where a specific hardcoded implementation was done for one method
Beta Was this translation helpful? Give feedback.
All reactions