[IPython-dev] Bug in our magic_arguments decorator for building docstrings (ping R. Kern)?

Fernando Perez fperez.net at gmail.com
Tue Jun 5 14:57:30 EDT 2012

Hey folks,

I'm sending this in case anyone already knows what's going on, or is
willing to dig into this issue a bit.

A while back we added (from R. Kern) the new magic_arguments module:


that allows you to build magics with a more friendly decorator-based
syntax.  But it seems that this decorator is severely mangling
docstrings, consider how the new Rmagic docs look:


The problem can even be seen with a simple example:

from IPython.core.magic_arguments import magic_arguments

def f():
    """A long




    and more text:

    * one
    * two
    * three

If we run this, we get:

In [5]: run ~/margs.py

In [6]: f?
Type:       function
Base Class: <type 'function'>
String Form:<function f at 0x2dce410>
Namespace:  Interactive
File:       /home/fperez/margs.py
Definition: f()

A long docstring with:: code blocks and more text: * one * two * three

In [7]:

As can be seen above, the entire docstring got rammed into a single line.

Has anyone encountered this before?  Robert, any ideas?



More information about the IPython-dev mailing list