开发者

How should I comment partial Python functions?

开发者 https://www.devze.com 2023-01-21 17:35 出处:网络
say I have the following code: def func(x, y = 1, z = 2): \"\"\" A co开发者_开发问答mment about this function \"\"\"

say I have the following code:

def func(x, y = 1, z = 2):
    """ A co开发者_开发问答mment about this function """
    return x + y + z

another_func = partial(func, z = 4)

What would be the correct or Pythonic way of documenting the another_func function?


See partial() description on http://docs.python.org/library/functools.html#functools.partial

Like this:

another_func.__doc__ = "My documentation"
0

精彩评论

暂无评论...
验证码 换一张
取 消