Breakdown of approaches to PEP318

DH no at sp.am
Sun Mar 28 12:45:49 EST 2004


Sean Ross wrote:

> Here's a breakdown of most of the syntax discussed re: PEP318 using an
> example from python-dev. There are probably several more (I've added [10]).
> The example applies both function decoration and annotation.

These are all ugly and unreadable.  If you had to do this I'd go with #9 
docstrings, but use javadoc (only the @ parts).

Actually it looks like epydoc already does this:
http://epydoc.sourceforge.net/
See their example:
http://epydoc.sourceforge.net/epytextintro.html
and list of all @tags:
http://epydoc.sourceforge.net/fields.html

An example with function decorators too:

def addObserver(self, obs) [synchronized, classmethod]:
     """
     Add an observer to be notified when something changes.

     @author:     John Smith
     @deprecated: The reason why this is deprecated.
     @param obs:  The observer, a class with a "notify" method or
                  else a function or callable.
     """

Note though this all really is beyond the initial scope of PEP 318.



More information about the Python-list mailing list