On 2026-03-16, Stefan Ram <[email protected]> wrote:
> Jon Ribbens <[email protected]> wrote or quoted:
>>                         I don't know why it says "type(self)",
>>because help(foo) where 'foo' is an instance of a class 'xyz'
>>seems to display the same as help(xyz) anyway.
>
>|Python 3.14
>
>|>>> import types
>
>|>>> self = types.SimpleNamespace()
>
>|>>> self.__doc__ = "my custom doc"
>
>|>>> help(self)
>|Help on SimpleNamespace:
>|namespace(__doc__='my custom doc')
>|    my custom doc
>
>|>>> help(type(self))
>|Help on class SimpleNamespace in module types:
>|class SimpleNamespace(builtins.object)
>| |  SimpleNamespace(mapping_or_iterable=(), /, **kwargs)
>| |  A simple attribute-based namespace.
>| |  Methods defined here:
> . . .

Ok, but does anyone ever set __doc__ on instances?
That's a pretty weird thing to do.

>>                                 the class itself doesn't have
>>a docstring either. So there is nothing to display no matter what
>>you type.
>
>   Even without docstrings, info about names, parameters etc. is shown.

Yes, everyone can see that from what OP has already posted here.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to