useless-metaclass-type (UP001) 源自 pyupgrade linter。 修复总是可用的。 作用 检查类定义中 __metaclass__ = type 的使用情况。 为什么这不好? 自从 Python 3 以来,__metaclass__ = type 是默认的,因此可以省略。 示例 class Foo: __metaclass__ = type 建议改为 class Foo: ... 参考 PEP 3115 – Python 3000 中的元类