[Tutor] error in docs regarding map

Tim Peters tutor@python.org
Wed, 06 Mar 2002 23:38:40 -0500


[Christopher Smith]
> OK, pretty soon I'll just trust my own judgement, but would you agree
> that the docs obtained when typing help(filter) are wrong--they say that
> the result of filter is a list; I think it should say that the result is
> a sequence (if a string is filtered, a string is returned and if a list
> is filtered, a list is returned).  If this is an error, should I file
> this at the SourceForge?

You could try <wink>.  The strings produced by

    print someobject.__doc__

(which is what help() looks at) are generally meant to be memory-refreshers,
not complete documentation.  The full truth about filter() is more
complicated than you realize so far, but is fully documented in the Library
Reference Manual.  If we put a lot of words in __doc__ strings, people don't
like that either.

> ...
> BTW, are the docs obtained when typing help(filter) or help(map)
> hardcoded into Python's source code?

Indeed they are.  If you have the Python source distribution (or get the
source from public CVS), you'll find the help string for filter() in
Python/bltinmodule.c:

static char filter_doc[] =
"filter(function, sequence) -> list\n\
\n\
...

and so on.