Why does value of __doc__ not a String type?

Alex Martelli aleax at aleax.it
Fri Aug 8 08:29:07 EDT 2003


dlo_olb wrote:

> 
> Hi,
> 
>>>> import types
>>>> type(types.BuiltinFunctionType.__doc__)
>>>> <type 'getset_descriptor'>

What string would you like it to be?  Whatever string value you
choose, that's the one and only string that would then be shown
for ANY builtin function or method... not very informative.  As
it is, instead, a descriptor, its __get__ method gets called,
when you access __doc__ on any given builtin function of method,
and that __get__ knows where to find the builtin's docstring
and return it.


Alex





More information about the Python-list mailing list