Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I comment partial Python functions?

say I have the following code:

def func(x, y = 1, z = 2):
    """ A comment 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?

like image 852
Jim Jeffries Avatar asked Oct 20 '10 15:10

Jim Jeffries


1 Answers

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

Like this:

another_func.__doc__ = "My documentation"
like image 130
kanaka Avatar answered Oct 15 '22 07:10

kanaka