【发布时间】:2023-03-24 22:08:01
【问题描述】:
我正在尝试让我的 Python 代码看起来更易读。我读了style guide,但我不知道如何获得这样的东西
x = foo(x); # compute the value of the next prime number
# that is larger than x (foo is a really bad
# choice for this function's name)
或者这个
x = x + 1 # Compensate for border
some other code # some other comment
你如何包装评论并像这样对齐它们?你不只是输入一堆space,对吗?如果我编辑了代码,我是否必须手动重新对齐 cmets?
我使用 emacs 作为我的编辑器。
【问题讨论】:
-
如果你想这样做(这是有问题的),你肯定希望文件中的空格是空格。如果您只是询问如何编写 emacs 以便您不需要手动输入所有这些空格……那么,您可以将任何击键绑定到任何函数,但您需要准确定义该函数之前应该执行的操作有人可以告诉你怎么写……
标签: python emacs alignment comments