本文介绍了何时使用"raise NotImplementedError"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否在提醒自己和您的团队正确实施课堂?我没有完全使用这样的抽象类:
Is it to remind yourself and your team to implement the class correctly?I don't fully get the use of an abstract class like this:
class RectangularRoom(object):
def __init__(self, width, height):
raise NotImplementedError
def cleanTileAtPosition(self, pos):
raise NotImplementedError
def isTileCleaned(self, m, n):
raise NotImplementedError
推荐答案
请注意,尽管主要说明的用例是该错误是对应该在继承的类上实现的抽象方法的指示,但您可以随意使用它,例如用于指示TODO
标记.
Note that although the main stated use case this error is the indication of abstract methods that should be implemented on inherited classes, you can use it anyhow you'd like, like for indication of a TODO
marker.
这篇关于何时使用"raise NotImplementedError"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!