Style for docstring

alister alister.ware at ntlworld.com
Fri Apr 22 17:12:56 EDT 2022


On Fri, 22 Apr 2022 14:36:27 -0500, Michael F. Stemper wrote:

> I'm writing a function that is nearly self-documenting by its name,
> but still want to give it a docstring. Which of these would be best from
> a stylistic point of view:
> 
> 
>    Tells caller whether or not a permutation is even.
> 
>    Determines if a permutation is even. (Alternative is that it's odd.)
> 
>    Returns True if permutation is even, False if it is odd.
> 
> 
> (Before somebody suggests it, I'm not going to put six weeks' worth of a
> course in group theory in there to help somebody who doesn't know what
> those standard terms mean.)

four guidance I would sugest Pep257 as a start point
which would suggest "Return True if permutation is even"




-- 
I think my career is ruined!


More information about the Python-list mailing list