Fwd: [Python-Dev] docstring before function declaration

Eric Nieuwland eric.nieuwland at xs4all.nl
Mon Mar 21 15:50:14 CET 2005

Nicholas Jacobson wrote:
> IIRC, Guido once mentioned that he regretted not
> setting function docstrings to come before the
> function declaration line, instead of after.
> [ examples deleted ]
> I think that commenting the function before its
> declaration, at the same tabbed point, increases the
> code's readability.
> What do you think about making this change at some
> point (e.g. Python 3000)?  Or if not, then having the
> option to toggle to this layout?

Please don't. All class attributes are declared within the class. 
Pulling out the docstring would make it an exception. The current 
situation is very clear and easy to explain to newbies.

If you feel the current position of the docstring may be the first 
attribute's docstring, insert a newline at the proper positions to 
separate the two. It works for me.


More information about the Python-Dev mailing list