raise-not-implemented (F901) 派生自 Pyflakes 代码检查器。 有时提供修复。 作用 检查引发 NotImplemented 的 raise 语句。 为什么这不好? NotImplemented 是二进制特殊方法使用的一种异常,用于指示某个操作未针对特定类型实现。 不应直接引发 NotImplemented。应引发 NotImplementedError,用于指示该方法是抽象的或未在派生类中实现。 示例 class Foo: def bar(self): raise NotImplemented 建议改为 class Foo: def bar(self): raise NotImplementedError 参考 Python 文档:NotImplemented Python 文档:NotImplementedError