Re: how to comment lot of lines in python
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: how to comment lot of lines in python

From: Michael Hobbs <mike@hobbshouse.org>
Date: Fri Mar 31 2006 - 18:59:34 CEST

Eric Deveaud wrote:
> olsongt@verizon.net wrote:
>
>> Eric Deveaud wrote:
>>
>>> diffuser78@gmail.com wrote:
>>>
>>>> Like in C we comment like
>>>> /*
>>>> Bunch of lines of code
>>>> */
>>>>
>>>> Should we use docstring """ """
>>>>
>>> I would say NO. docstring are displayed by pydoc, thus a pydoc on your
>>> code will display some inconsistent information ;-)
>>>
>>>
>> docstrings are a bit of a magical construct. Not all strings in a
>> function are docstrings.
>>
>
>
> yep fogotten that triple quotted strings are considered as docstring
> only if they are the first lines of the module/fonction/class/method
> excluding the comments lines.
>
The official rule is that if *any* string is the first line of a
function/etc, it is considered a docstring. It's just standard
convention to use the triple quotes for docstrings. As you mentioned,
you can use triple quotes for any string; likewise, you can use standard
quotes ( ' or " ) for docstrings as well.

- Mike
Received on Sun Apr 30 21:48:08 2006