[Python-Dev] pydoc for named tuples is missing methods

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Mar 16 00:57:00 CET 2011

Nick Coghlan wrote:

> The challenge here is how it would interact with inheritance. pydoc
> couldn't use normal attribute lookup, it would have to walk the MRO
> manually,

This is an instance of a pattern that I've encountered a
few times in things that I've done: you have a class
attribute containing a list of things, and you want it
to be "additive" with respect to inheritance -- i.e. it
contains the items specified in a particular class plus
all those specified in its base classes.

This can obviously be arranged using appropriate metaclass
hackery, but I'm wondering whether it could be provided
using some mechanism that can be applied orthogonally
to any class attribute.

Maybe this is another reason to have a hook somewhere
in the standard class creation process that allows a
descriptor to initialise itself with knowledge of its


More information about the Python-Dev mailing list