[Python-ideas] Proposal: Use mypy syntax for function annotations
Nathaniel Smith
njs at pobox.com
Thu Aug 14 21:14:27 CEST 2014
On 14 Aug 2014 17:02, "Sunjay Varma" <varma.sunjay at gmail.com> wrote:
> Here's a taste of what that looks like:
> class SimpleEquation(object):
>
> def demo(self, a, b, c):
> """
> This function returns the product of a, b and c
> @type self: SimpleEquation
> :param a: int - The first number
> :param b: int
> :param c: int - The third number should not be zero and
should also
> only be -1 if you enjoy carrots (this comment spans 2
lines)
> :return: int
> """
> return a * b * c
There are at least three existing, popular, standardized syntaxes for these
kinds of docstring annotations in use: plain ReST, Google's docstring
standard, and numpy's docstring standard. All are supported by Sphinx out
of the box. (The latter two require enabling the "napolean" extension, but
this is literally a one line config file switch.)
Would you suggest that python-dev should pick one of these and declare it
to be the official standard, or...?
-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140814/190b006b/attachment-0001.html>
More information about the Python-ideas
mailing list