Error when __doc__ is a property

Laurent Gautier avatarLaurent Gautier created an issue

I have instance-specific docstrings that are lazily evaluated (long story short, extracting the information needed to make the docstring would make the creation of instances much slower, while the docstring is very rarely used).

The implementation is roughly looking like this:

class A(object):
    """ Some doc one will not see. """
    def get_doc(self):
        # get instance-specific documentation here

    __doc__ = property(get_doc)

When using sphinx to document this, it fails with:

site-packages/sphinx/util/", line 24, in prepare_docstring
    lines = s.expandtabs().splitlines()
AttributeError: 'property' object has no attribute 'expandtabs'

(I am aware that I might be bending the rules regarding what __doc__ should be).

Comments (2)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.