在使用重构文本/Sphinx编制文档时,如何将参数类型及其声明包括在内?

2024-04-23 06:35:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我熟悉使用两行代码记录Python函数的参数,如下所示:

def get_market_history(self, market, count):
    """
    Used to retrieve the latest trades that have occured for a
    specific market.

    /market/getmarkethistory

    :param market: String literal for the market (ex: BTC-LTC)
    :type market: str

但是我知道对于简单类型,可以在:param行中包含类型,因此只需要一行而不是两行。但我忘了它的语法,希望能举个例子


Tags: the函数代码self类型for参数get