函数中Python多行字符串的正确缩进是什么?
def method():
string = """line one
line two
line three"""
Run Code Online (Sandbox Code Playgroud)
要么
def method():
string = """line one
line two
line three"""
Run Code Online (Sandbox Code Playgroud)
或者是其他东西?
在第一个例子中将字符串悬挂在函数外部看起来有点奇怪.
像pep8这样的工具可以查看源代码样式,但是它们不会根据pep257,pep287来检查docstrings是否已经过滤.有这样的工具吗?
更新
我决定自己实现这样一个静态分析工具,请参阅: