verbs in comments [OT]

Kiuhnm kiuhnm03.4t.yahoo.it
Sat Mar 24 22:15:54 CET 2012


On 3/24/2012 21:24, MRAB wrote:
> On 24/03/2012 19:36, Kiuhnm wrote:
>> Why do you write
>> // Print the number of words...
>> def printNumWords(): ...
>> and not
>> // Prints the number of words...
>> def printNumWords(): ...
>> where "it" is understood?
>> Is that an imperative or a base form or something else?
>>
> The first is the imperative, the second is what it does (with the
> implied "it").
>
> Which form you use depends on what "feels" right.
>
> Probably what I'd do is use the first form where it's called and the
> second form where it's defined.
>
> # Prints the number of words.
> def print_num_words():
> ...
>
> # Print the number of words.
> print_num_words()
>
> Although in this example the function is better written with a
> docstring, and the comment where the function is called doesn't add
> anything useful, so it's probably unnecessary.

Thank you.

Kiuhnm



More information about the Python-list mailing list