https://bugs.kde.org/show_bug.cgi?id=400536

            Bug ID: 400536
           Summary: Extract attribute docstrings according to PEP258
           Product: kdev-python
           Version: 5.2.4
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: m...@svenbrauch.de
          Reporter: nicolas.alva...@gmail.com
                CC: m...@svenbrauch.de
  Target Milestone: ---

Python doesn't "officially" have attribute docstrings, in the sense that
nothing will automatically fill the __doc__ of an attribute. However, PEP 258
(https://www.python.org/dev/peps/pep-0258/#attribute-docstrings) defines a
convention for external documentation-extracting tools, where a string literal
immediately following a simple assignment is interpreted as documentation for
the thing being assigned.

KDevelop doesn't support this. It seems to extract the string literal *before*
an assignment. This is worse than extracting nothing, because if docstrings are
written according to the PEP so that docutils extracts them properly,
KDevelop's tooltip will show the wrong thing.

Here's an example from the PEP.

g = 'module attribute (module-global variable)'
"""This is g's docstring."""

class AClass:

    c = 'class attribute'
    """This is AClass.c's docstring."""


In KDevelop, "This is g's docstring" appears in the tooltip for 'c' instead.

Another example:

class Obj:
    """Obj's docstring, extracted correctly"""

    foo=1
    """this should be foo's docstring"""

    bar=2
    """this should be bar's docstring"""

In this example, "foo" shows no documentation in the tooltip, and "bar" shows
the docstring for "foo" instead.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to