Cells.set_doc#

Cells.set_doc(doc, insert_indents=False)[source]#

Set the doc property

By default, set_doc() works the same as Cells.doc property setter.

If doc is a multi-line string and True is passed to the insert_indents parameter, the second and subsequent lines of doc are auto-indented.

Example

This example shows how the docstring of a Cells can be set with or without indentation from an unindented string:

>>> @mx.defcells
... def foo(x):
...     return x

>>> doc = """This is foo
...
... multiple line docstring
... """

>>> foo.set_doc(doc)    # Or foo.doc = doc

>>> foo.formula
def foo(x):
    """This is foo

multiple line docstring
"""
    return x

>>> foo.set_doc(doc, insert_indents=True)

>>> foo.formula
def foo(x):
    """This is foo

    multiple line docstring
    """
    return x
Parameters:
  • doc (str) – a documentation string

  • insert_indents (bool, optional) – Whether to auto-indent subsequent lines in doc. Defaults to False

See also

doc

New in version 0.14.0.