从文档中可以看出,双引号用于 文字,而当有代码文本被解释时使用单个反引号。
这将导致我为方法编写docstring f()
下面:
class A(B):
def f(arg1, arg2):
return B(arg1 + arg2 + self.index)
如:
Takes two arguments, ``arg1` and ``arg2``, which are assumed to be objects
of type (or duck-type) `NiceClass`, and returns a new object of class `B`
with `B.something` assigned some hash of ``arg1`` and ``arg2``.
这是正确的吗?
在许多代码示例中,Sphinx和其他方面,我看到相当于 B
和 NiceClass
用双引号括起来(“``B``”和“``NiceClass``”)。