0

I'm learning Python's Twisted, and have to use their docstrings for help, as the documentation isn't the best. Fortunately the source code has good docstrings. For example I'm learning to use a LoopingCall (class documentation, source code). But some of the notation confuses me. Having seen others' Java code, I get the following bits:

@ivar f: The function to call.
@ivar a: A tuple of arguments to pass the function.
@ivar kw: A dictionary of keyword arguments to pass to the function.
@ivar clock: A provider of
    L{twisted.internet.interfaces.IReactorTime}.  The default is
    L{twisted.internet.reactor}. Feel free to set this to
    something else, but it probably ought to be set *before*
    calling L{start}.
...
@type _runAtStart: C{bool}
@ivar _runAtStart: A flag indicating whether the 'now' argument was passed
    to L{LoopingCall.start}.

I get how the @label is defining/documenting parameters for the class and its attributes. But does the C{...} specify the class or datatype? But then the first line of the class docstring is

If C{f} returns a deferred, rescheduling will not take place until the deferred has fired. The result value is ignored.

so does that refer to the parameter f which is a function, and says what happens if that parameter returns a deferred?

And what in the world does the L{...} notation mean? It refers to L{LoopingCall.start}, and I know that's a method that can be called on the LoopingCall, but is there any additional significance to the L{} or just a computer-science-y way of saying "this is a class method that we're referring to here"?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
TCAllen07
  • 1,294
  • 16
  • 27
  • 1
    That is special notation for generating the documentation (which is *automatically created from the docstrings*) - note that in the formatted documentation you link to the items with the braces are formatted differently. `L` appears to mean **l**ink and `C` **c**ode. – jonrsharpe Mar 18 '15 at 14:19
  • Thanks @jonrsharpe, that's pretty cool! As I'm creating my first full-on application, I'll get to make a point to learn this for generating my own documentation. – TCAllen07 Mar 18 '15 at 16:16
  • No problem - turns out I made a pretty good guess! There are various other styles available - I like [the Google style with Sphinx-Napoleon](http://sphinxcontrib-napoleon.readthedocs.org/en/latest/example_google.html), as I think they're easier to read even without the formatting, but YMMV. – jonrsharpe Mar 18 '15 at 16:17

0 Answers0