通常,我編輯文檔字符串並找到我的編輯將線條的寬度推過所需的右邊距。因此,在我的文檔字符串再次被接受之前,可能需要重新格式化此編輯下面的許多行文本。
什麼是自動解決這個問題的簡單而安全的方法?自動將文檔重新格式化以尊重右邊距
例如:
class WellDocumentedClass:
"""The first line of this is <72 characters wide. And is above lots|
more text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.|
et mauris ac eros placerat auctor. Mauris mollis est scelerisse |
accumsan dapibus. Ut imperdiet suscipit lacinia. Maecenas volutpat |
iaculis malesuada. Sed venenatis ipsum gravida molestolaoreet. Fuse|
facilisis neque nec mauris maximus rutrum. Suspendisse at vestibulo|
orci, ut feugiat odio. Aliquam erat volutpat. Nulla accumsan justo |
ligula, at imperdiet quam ultrices non. Cras vitae vehicula ligula.|
Quisque quam massa, dignissim in volutpat in, mattis eu urna. |
"""
pass
哦,不!我意外地從第一行中省略了「docstring」這個詞。它的格式非常完美!
class WellDocumentedClass:
"""The first line of this docstring is <72 characters wide. And is |above lots
more text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.|
et mauris ac eros placerat auctor. Mauris mollis est scelerisse |
accumsan dapibus. Ut imperdiet suscipit lacinia. Maecenas volutpat |
iaculis malesuada. Sed venenatis ipsum gravida molestolaoreet. Fuse|
facilisis neque nec mauris maximus rutrum. Suspendisse at vestibulo|
orci, ut feugiat odio. Aliquam erat volutpat. Nulla accumsan justo |
ligula, at imperdiet quam ultrices non. Cras vitae vehicula ligula.|
Quisque quam massa, dignissim in volutpat in, mattis eu urna. |
"""
pass
Argh。時間使用我的鼠標和按下輸入很多...除非...你在這樣的時刻做什麼?