Python 强制子类实现父方法pylance
在我编写代码时,是否有办法对未实现的方法发出pylance警告 在运行时,我们可以使用Python 强制子类实现父方法pylance,python,visual-studio-code,pylance,Python,Visual Studio Code,Pylance,在我编写代码时,是否有办法对未实现的方法发出pylance警告 在运行时,我们可以使用raisenotimplementederror确保每个子类在调用父类方法之前都重写它 class blueprint: def methodA(self): raise NotImplementedError class myClass(blueprint): def methodB(self): pass myInstance = myClass()
raisenotimplementederror
确保每个子类在调用父类方法之前都重写它
class blueprint:
def methodA(self):
raise NotImplementedError
class myClass(blueprint):
def methodB(self):
pass
myInstance = myClass()
myInstance.methodA() #raises error at runtime, I want this to show error or warning before runtime
因为我可能不会在每个阶段测试应用程序的每个部分。如果我在运行时没有调用未实现的方法,我想确保它会通知我,甚至,,编写一个执行此分析的PyLint插件