[Python-Dev] Doc strings for typeslots?
Guido van Rossum
Tue, 25 Mar 2003 18:02:14 -0500
> 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?
Um, I'm afraid this is how it is. __xxx__ methods have generic
--Guido van Rossum (home page: http://www.python.org/~guido/)