我用Python3编码,并使用pylint保持代码整洁.
我想定义一些类似接口类的东西,这样我可以以简洁明了的方式添加更多功能,然而,pylint阻碍了这一目标的实现.
下面是一个示例方法:
def on_enter(self, dummy_game, dummy_player): #pylint disable=no-self-use
"""Defines effects when entering area."""
return None
以下是pylint输出:
R: 70, 4: Method could be a function (no-self-use)
问题是:
- 如何 suppress 警告(注意
#pylint
条注释)?或 - 我如何告诉pylint这只是一个接口(注意
dummy_game
和dummy_player
)
编辑:
pylint 1.2.1,
astroid 1.1.1, common 0.61.0
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1]