[Python-Dev] docstrings, help(), and __name__

Michael Hudson mwh@python.net
07 Aug 2002 16:36:21 +0100

"David Abrahams" <dave@boost-consulting.com> writes:

> [function-like object with no __name__ breaks pydoc]
> It seems I'm breaking some protocol. It's easy enough to add a '__name__'
> attribute to my function objects, but I'd like to be sure that I'm adding
> everything I really /should/ add.

I am fairly certain the protocols inspect uses are not written down
anywhere.  I think they're defined entirely by the implementation.

> Just how much like a regular Python function does my function have
> to be in order to make the help system (and other standard systems
> with such expectations) happy?

"Use the source, Luke."  Not a good answer, but probably the only one.

I guess inspect thinks your object looks like a method descriptor?  It
certainly seems to think it's a "routine" whatever that means...


  Famous remarks are very seldom quoted correctly.
                                                    -- Simeon Strunsky