Issues

Issue #223 wontfix

Cross-Reference roles only link to first instance

Anonymous created an issue

I have the following situation. I have a class promoted into Python using the Python/C API. This class has methods. Some of these methods are overloaded. In my documentation I have something like the following:

{{{

!rst

.. class:: MyClass

This is my class.

.. method run( Foo a ) -> string

Run on a Foo object.

.. method run( Bar b, Bug c ) -> string

Run on Bar and Bug objects.

}}}

Now when I reference the methods there is no way to specify which one I want:

{{{

!rst

In order to run using a :class:Foo then use the :meth:MyClass.run method. }}}

This will always resolve to the first class method. It seems that what is needed is an interface much like the ':ref:' role. Something where we can do the following:

{{{ :meth:MyClass.run <MyClass.run( Foo a )> }}}

Where the method signature can be provided and possibly the text that appears for the link.

Comments (2)

  1. Georg Brandl repo owner

    I think this is too involved for something that's very rarely needed for Python code, so I'll not change it.

    You could however write the docs a bit differently:

    .. method:: run(Foo a)
                run(Bar b)
    
       Docs for "the first form" and "the second form"...
    
  2. Log in to comment