[Python-Dev] docstring before function declaration

Nicholas Jacobson nicksjacobson at yahoo.com
Mon Mar 21 08:10:43 CET 2005


IIRC, Guido once mentioned that he regretted not
setting function docstrings to come before the
function declaration line, instead of after.

i.e.

"""This describes class Bar."""
class Bar:
...

Or with a decorator:

"""This describes class Bar."""
@classmethod
class Bar:
    ...

Versus the current method:

class Bar:
    """This describes class Bar."""
    def foo:
    ...

where the docstring looks like it refers to foo, not
Bar.

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?

Thanks,

--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