A trivial question that I don't know - document a function/method

Karsten Hilbert Karsten.Hilbert at gmx.net
Sun Oct 23 14:37:46 EDT 2022


Am Sat, Oct 22, 2022 at 09:49:55PM -0400 schrieb Thomas Passin:

> def make_title_from_headline(self, p, h):
>     """From node title, return title with over- and underline- strings.
...
>        RETURNS
>        a string
>     """
....
> def plot(self, stackposition=MAIN, clearFirst=True):
>     """Plot a 2-D graph.
...
>     RETURNS
>     nothing
>     """

Would it not, these days, be clearer to

	def make_title_from_headline(self, p, h) -> str:

	def plot(self, stackposition=MAIN, clearFirst=True) -> None:

and use RETURNS (or Returns:) only when what is returned
warrants further explanation (say, as to what is returned
when).

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B


More information about the Python-list mailing list