Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22124

Re: verbs in comments [OT]

Date 2012-03-24 20:24 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: verbs in comments [OT]
References <4f6e2265$0$1382$4fafbaef@reader2.news.tin.it>
Newsgroups comp.lang.python
Message-ID <mailman.956.1332620684.3037.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

verbs in comments [OT] Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-24 20:36 +0100
  Re: verbs in comments [OT] MRAB <python@mrabarnett.plus.com> - 2012-03-24 20:24 +0000
    Re: verbs in comments [OT] Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-24 22:15 +0100
  Re: verbs in comments [OT] Chris Angelico <rosuav@gmail.com> - 2012-03-25 09:36 +1100
    Re: verbs in comments [OT] Roy Smith <roy@panix.com> - 2012-03-24 19:27 -0400
  Re: verbs in comments [OT] Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-03-26 14:36 +0200

csiph-web