5

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?

3
  • 3
    the most correct way is demonstrated in the docs Commented Oct 20, 2010 at 15:19
  • user368186, did my answer work for you? If so can you select it as correct? Commented Oct 21, 2010 at 13:00
  • Sorry, in my delayed response. Busy day. That is great thankyou. Commented Oct 21, 2010 at 16:09

1 Answer 1

6

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

Like this:

another_func.__doc__ = "My documentation"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.