您如何在 Python 中正确添加不必要的缩进(出于组织目的)而没有 pylint 抱怨?
How do you properly add an unnecessary indent (for organisational purposes) in Python without pylint complaining?
我目前正在使用
if True:
...
为了组织目的添加额外的缩进,但这会使 pylint 抱怨 using-constant-test。在 Python 中是否有针对这种情况的某种正确的声明(类似于 pass
),而不会像这样滥用 if
声明?
这不是 this other question 的副本,因为它与 pylint 无关。
如果您只是想让消息不再烦扰您,您可以通过评论禁用它,
在整个文件中:
# pylint: disable=using-constant-test
if True:
...
或仅针对该行:
if True: # pylint: disable=using-constant-test
...
我目前正在使用
if True:
...
为了组织目的添加额外的缩进,但这会使 pylint 抱怨 using-constant-test。在 Python 中是否有针对这种情况的某种正确的声明(类似于 pass
),而不会像这样滥用 if
声明?
这不是 this other question 的副本,因为它与 pylint 无关。
如果您只是想让消息不再烦扰您,您可以通过评论禁用它, 在整个文件中:
# pylint: disable=using-constant-test
if True:
...
或仅针对该行:
if True: # pylint: disable=using-constant-test
...