[Python-Dev] Doc strings for typeslots?

Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 26 Mar 2003 10:49:27 +1200 (NZST)


A Pyrex user recently pointed out to me that trying
to give a docstring to an __xxx__ method of an
extension type doesn't work.

The reason for this is that the C functions implementing
these methods live in slots of the typeobject, and there's
apparently nowhere to put docstrings for them.

I'm speculating that this could be worked around by
getting the slot's wrapper object out of the type
dict after the type is initialised, and stuffing a
docstring into it.

This would only work if a new set of wrappers is created
for each type, rather than re-using generic ones. An
experiment suggests that this is what happens -- can
anyone confirm this?

Or, is there a better way of giving these things
docstrings that I've missed?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+