[Python-ideas] Proposal: Use mypy syntax for function annotations
Ethan Furman
ethan at stoneleaf.us
Thu Aug 14 19:29:01 CEST 2014
On 08/14/2014 09:01 AM, Sunjay Varma wrote:
>
> Additionally, this approach can be used by documentation generators as well and removes any duplication from the
> function declaration and the docstring.
>
> 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
+1 I like this much more.
--
~Ethan~
More information about the Python-ideas
mailing list