verbs in comments [OT]

Chris Angelico rosuav at gmail.com
Sat Mar 24 18:36:46 EDT 2012


On Sun, Mar 25, 2012 at 7:32 AM, Colton Myers <colton.myers at gmail.com> wrote:
>
> // Print the number of words...
> // Prints the number of words...
>
> I've seen it both ways, and I don't think anyone will fault you for either.
>  I usually use the first version, "commanding" the code to do what I want.
>  It's also a habit because that's the form one uses in git commit messages.

It's funny how these things go. There are multiple distinct
conventions, and regarding function definition comments (or
docstrings), both of those do definitely exist. I think I've seen more
code in the second form ("this is what this code does"), but both are
prevalent.

Regarding git commit messages, the convention generally is to write in
the present tense ("this is what this commit does"), but on a wiki,
edit summaries are more often in the past tense ("this is what I
edited"). Why? Because on a wiki, nobody's going to 'git cherry-pick'
the edits.

ChrisA



More information about the Python-list mailing list