Style for docstring

Michael F. Stemper michael.stemper at gmail.com
Fri Apr 22 16:35:15 EDT 2022


On 22/04/2022 14.59, Chris Angelico wrote:
> On Sat, 23 Apr 2022 at 05:56, Michael F. Stemper
> <michael.stemper at gmail.com> 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.


> 
> I'd go with the third one, but "Return" rather than "Returns". Or
> possibly "Test whether a permutation is even".

"So let it be written. So let it be done."

> That's just one opinion though, others may disagree :)

Two for two. Thanks.


-- 
Michael F. Stemper
Always remember that you are unique. Just like everyone else.


More information about the Python-list mailing list