Feature: enhance autoclass:: to use the docstring of __new__

The method new is an alternative to __init__, but autoclass does not 
respect __new__. This commit enhances the directive autoclass:: to try
__new__ method's docstring, if __init__ method's docstring is missing or
empty.

The commit also adds tests and updates the documentation.
This commit is contained in:
Anselm Kruis
2016-02-05 19:09:43 +01:00
parent 50951bdc98
commit 0311f33347
3 changed files with 48 additions and 0 deletions

View File

@@ -314,6 +314,12 @@ There are also new config values that you can set:
.. versionadded:: 0.3
If the class has no ``__init__`` method or if the ``__init__`` method's
docstring is empty, but the class has a ``__new__`` method's docstring,
it is used instead.
.. versionadded:: 1.4
.. confval:: autodoc_member_order
This value selects if automatically documented members are sorted