what is "@param" in docstrings?

Georg Brandl g.brandl-nospam at gmx.net
Sat Oct 28 14:36:10 EDT 2006


georgeryoung at gmail.com wrote:
> I'm starting to read about twisted and I keep seeing things like:
> [from twisted/internet/app.py]
> 
>     def __init__(self, name, uid=None, gid=None, authorizer=None,
> authorizer_=None):
>         """Initialize me.
>         If uid and gid arguments are not provided, this application
> will
>         default to having the uid and gid of the user and group who
> created it.
> 
>         @param name: a name
> 
>         @param uid: (optional) a POSIX user-id.  Only used on POSIX
> systems.
> 
>         @param gid: (optional) a POSIX group-id.  Only used on POSIX
> systems.
>         """
>         _AbstractServiceCollection.__init__(self)
>         self.name = name
>         ...
> 
> What does the "@param" mean?  It looks like something meant to be
> machine readable.  Alas, googling on "@param" doesn't work...  It looks
> at first like a decorator, but that doesn't make much sense.

It's docstring markup that can be parsed by e.g. epydoc. It's borrowed
from JavaDoc's similar syntax.

Georg



More information about the Python-list mailing list