1

默认情况下,pylint v2.9.6 会给出以下警告:

垃圾邮件

"""Docstring."""


def spam():
    """Docstring."""
    spam = 42
    return spam

皮林特警告

spam.py|6 col 5 warning| [redefined-outer-name] Redefining name 'spam' from outer scope (line 4) [python/pylint]

创建以下 .pylintrc 后,不再给出警告。这是不希望的。

.pylintrc可能的位置

[VARIABLES]

# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
#dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
dummy-variables-rgx=

为什么?

4

0 回答 0