A literal "*" in RestructuredText

Sardathrion - against SE abuse picture Sardathrion - against SE abuse · May 26, 2015 · Viewed 8.5k times · Source

I am looking at this snippet of code:

def ook(*args):
    """Some silly function.

    :param *args: Optional arguments.
    """
    ...

And as soon as I run Sphinx, I get the oh-so helpful error:

WARNING: Inline literal start-string without end-string.

So, I tried param ``*``args, param :literal:'*' args and still get the warning.

How do I have a literal '*' in restructuredText?

Answer

knitti picture knitti · May 26, 2015

You could use the (somewhat ugly) backslash quotation: \*

EDIT: As an (somewhat ugly) addendum, if you are concerned about pylint warning about the backslash, you could add a r to the string literal: r""" ... docstring ... """. This was descibed in this pylint issue.

Having different text processing systems play nicely together destroys sometimes the aesthetics.