Open
Description
Hi @ssanderson, congratulations on the package!
We have an in-house of implementation of interfaces which is very similar to yours in philosophy and usage.
One key difference in our implementation is that we use a decorator to signal implementation instead of subclassing. For example:
class MyClass(implements(MyInterface)):
def method1(self, x):
return x * 2
def method2(self, x, y):
return x + y
In our framework is written as:
@implements(MyInterface)
class MyClass:
def method1(self, x):
return x * 2
def method2(self, x, y):
return x + y
On advantage is that we don't need to insert any classes in the user's hierarchy, similar to how attr.s
works, which is less intrusive.
This is not really an issue but more of a question on what you think about the approach of using a decorator?
Metadata
Metadata
Assignees
Labels
No labels