Skip to content

Overly verbose output for namedtuples #257

Closed
@anntzer

Description

@anntzer

numpydoc generates rather verbose outputs for namedtuples, especially when combined with autosummary:

$ sphinx-quickstart -q -m --sep -pfoo -afoo --extensions=sphinx.ext.autosummary,numpydoc

then edit source/index.rst to contain

.. autosummary::
   foo.Foo

.. automodule:: foo
   :members:

and foo.py to contain

from collections import namedtuple

Foo = namedtuple("Foo", "bar baz")

then build with

PYTHONPATH=. make html

This results in
bad

Compare with the result using either not numpydoc at all, or sphinx.ext.napoleon instead:
good

I guess whether "count" and "index" should be listed as methods can be argued over, but having "bar" and "baz" being listed twice seems clearly too much, and the "Attributes" entry in the autosummary table is not so great either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions