Issues

Issue #520 resolved

Adding magic methods

Anonymous created an issue

Enhancement reason: I tried making documentation for a project and found out the sphinx didn't show methods such as init, len.

Enhancement: After som diggin in the autodoc.py file I found out these methods aren't documented cause of this line:

Line 538: {{{

!python

if want_all and membername.startswith('_'): # ignore members whose name starts with _ by default skip = True }}}

Basicly is hides privatemethods but also magic methods.

My hack to that is: {{{

!python

magic_functions = ['str', 'init', 'len', 'lt', 'eq', 'ne', 'ge', 'gt', 'le', 'repr', 'iter' ] if want_all and membername.startswith('_') and not membername in magic_functions:

}}}

Alternatively the hack could be made differently by just testing if a mether starts and ends with '__'. This would be better under the assumption people don't use the magic method naming scheme on private methods.

This also solves the no constructor method documentation, and the issue http://bitbucket.org/birkenfeld/sphinx/issue/176/provide-option-to-include-private-and-special.

Comments (4)

  1. Daniel Neuhäuser

    These are by far not all special methods(that's what they are called by the documentation). I think we should differ between methods starting with _ and methods enclosed by like foo. Both variants should be documented if the user supplies an option like :private-members:/:special-members:

  2. Log in to comment