Message180544
I had an innocent question about the format to use when listing function arguments in docstrings. In the PEP 257 doc, there's a single example:
def complex(real=0.0, imag=0.0):
"""Form a complex number.
Keyword arguments:
real -- the real part (default 0.0)
imag -- the imaginary part (default 0.0)
I went digging through Lib/ for a good example to follow, but felt a little unsure because the exact format seemed to differ ever so slightly sometimes.
Like in ipaddress.py, a colon is used instead of two hyphens, and it's indented:
def ip_address(address):
"""Take an IP string/int and return an object of the correct type.
Args:
address: A string or integer, the IP address. Either IPv4 or
IPv6 addresses may be supplied; integers less than 2**32 will
be considered to be IPv4 by default.
Is there an "ideal" example in the source to try to copy?
(or maybe this is just a use-your-common-sense thing) |
|
Date |
User |
Action |
Args |
2013-01-24 19:39:27 | dlam | set | recipients:
+ dlam, ezio.melotti, eli.bendersky, docs@python, tshepang, serhiy.storchaka |
2013-01-24 19:39:27 | dlam | set | messageid: <1359056367.32.0.437945018876.issue16954@psf.upfronthosting.co.za> |
2013-01-24 19:39:27 | dlam | link | issue16954 messages |
2013-01-24 19:39:26 | dlam | create | |
|