【发布时间】:2017-12-19 14:55:02
【问题描述】:
我编写了一些 python 脚本,而且在大多数情况下,我对自动格式化程序的工作方式完全满意。但有时我想保持垂直一致性或在逻辑上将代码分成几行。
# autoformatter removes all leading spaces here
array = numpy.array([[
[ 0, 1589, 25825225, 1589, 0],
[ 1589, 26265625, 26265625, 26265625, 1589],
[25825225, 26265625, 26265625, 26265625, 25825225],
[ 1589, 26265625, 26265625, 26265625, 1589],
[ 0, 1589, 25825225, 1589, 0],
]])
# autoformatter splits line at '-' sign in the first brackets
links[point.degree - 1].append([
neighbor.index for neighbor in point.neighbors
])
有没有办法告诉自动格式化程序(我使用 VSC 的默认 Python 包)忽略这些行(类似于 # pylint: disable=C0123 魔术注释)?
【问题讨论】:
标签: python visual-studio-code autoformatting