-3

As mentioned in the subject line for a given objec (module or class)

print (object.__doc__)   works
document.write (object.__doc__)
TypeError" write: () argument must be a str not None

I do get type(object.__doc__) is None

Update: Grrr...indeed the first object in the list had not doc string Now the error mutated to TypeError" must be a str not type

MiniMe
  • 1,057
  • 4
  • 22
  • 47
  • 2
    Cannot reproduce: on my machine, `type(object.__doc__)` gives ``. Do you have a complete example? https://stackoverflow.com/help/mcve – NPE Oct 20 '18 at 22:52
  • What does `print(object.__doc__)` print? `None`? – user2357112 Oct 20 '18 at 22:54
  • I think this can answer part of your question https://stackoverflow.com/questions/33066383/print-doc-in-python-3-script no? – Rocky Li Oct 20 '18 at 22:55

1 Answers1

0

Assuming that by object you don't mean the built-in object class but rather your own class.

For __doc__ to not be None, the class in question has to have a docstring.

Contrast:

>>> class X(object):
...    pass
... 
>>> type(X.__doc__)
<type 'NoneType'>

with:

>>> class Y(object):
...    "Class Y"
... 
>>> type(Y.__doc__)
<type 'str'>
NPE
  • 486,780
  • 108
  • 951
  • 1,012
  • Yes that was the case..the problem is that I was looking at the next object that did have the __doc__ string Now I am facing another issue ..please see the update – MiniMe Oct 20 '18 at 23:29