支持"重新定义内置..." pylint警告

时间:2017-11-19 13:17:14

标签: python python-3.x pylint

使用Python2 / 3 compatibility导入时,例如

from builtins import bytes

pylint发出警告:

  

重新定义内置' bytes' (重新定义-内建)

如何为builtins模块抑制它们?

1 个答案:

答案 0 :(得分:1)

自pylint 1.6以来,有一个新选项--redefining-builtins-modules。将builtins添加到其默认值six.moves,future.builtins可解决问题:

# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins,builtins