我有这个代码:
class AppInterface(zope.interface.Interface):
def required_function():
pass
@zope.interface.implementer(AppInterface)
class DesktopApp:
def other_function(self):
print('Who I am')
我没有在 DekstopApp 中编写所需的函数,它必须引发错误。
但是这段代码有效。
但是当我使用 abc 模块时,如果我没有编写所需的方法,我会得到一个错误。
我应该使用 abc 还是 zope.interface?