what is "@param" in docstrings?

G

georgeryoung

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.

-- George Young
 
G

Georg Brandl

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top