Tool that can document private inner class?

Weatherby,Gerard gweatherby at uchc.edu
Tue Feb 7 15:53:30 EST 2023


Yes.

Inspect module

import inspect


class Mine:

    def __init__(self):
        self.__value = 7

    def __getvalue(self):
        """Gets seven"""
        return self.__value


mine = Mine()
data = inspect.getdoc(mine)
for m in inspect.getmembers(mine):
    if '__getvalue' in m[0]:
        d = inspect.getdoc(m[1])
        print(d)


From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of Ian Pilcher <arequipeno at gmail.com>
Date: Tuesday, February 7, 2023 at 3:34 PM
To: python-list at python.org <python-list at python.org>
Subject: Tool that can document private inner class?
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

I've been banging my head on Sphinx for a couple of days now, trying to
get it to include the docstrings of a private (name starts with two
underscores) inner class.  All I've managed to do is convince myself
that it really can't do it.

See https://urldefense.com/v3/__https://github.com/sphinx-doc/sphinx/issues/11181__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh9C4AH_g$<https://urldefense.com/v3/__https:/github.com/sphinx-doc/sphinx/issues/11181__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh9C4AH_g$> .

Is there a tool out there that can do this?

--
========================================================================
Google                                      Where SkyNet meets Idiocracy
========================================================================
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh_9Xz7jg$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh_9Xz7jg$>


More information about the Python-list mailing list