A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/052327.html below:

[Python-Dev] docstring before function declaration

[Python-Dev] docstring before function declaration [Python-Dev] docstring before function declarationNicholas Jacobson nicksjacobson at yahoo.com
Mon Mar 21 10:08:59 CET 2005
Rule #1: If the docstring is the first line of a
module, it's the module's docstring.

Rule #2: If the docstring comes right before a
class/function, it's that class/function's docstring.

> How do you distinguish between a docstring at the
> top of a module 
> that's immediately followed by a  function? Is it
> the module docstring 
> or the function docstring?

It's both.  The docstring would be assigned to both
the module and the function.  This is a *good* thing
when there is a module with only one function in it. 
i.e. there should only be one docstring for both, and
this saves repetition of that docstring.

If a programmer wanted a docstring for the function
but not the module, a blank first line would do the
trick.  A docstring for the module but not the
function?  Put a blank line between the module's
docstring and the function.

--Nick Jacobson



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4