Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ Retrieving source code
If the documentation string for an object is not provided and the object is
a class, a method, a property or a descriptor, retrieve the documentation
string from the inheritance hierarchy.
Return ``None`` if the documentation string is invalid or missing.

.. versionchanged:: 3.5
Documentation strings are now inherited if not overridden.
Expand All @@ -535,12 +536,14 @@ Retrieving source code

.. function:: getmodule(object)

Try to guess which module an object was defined in.
Try to guess which module an object was defined in. Return ``None``
if the module cannot be determined.


.. function:: getsourcefile(object)

Return the name of the Python source file in which an object was defined. This
Return the name of the Python source file in which an object was defined
or ``None`` if no way can be identified to get the source. This

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or ``None`` if no way can be identified to get the source. This
or ``None`` if it cannot be identified. This

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! But, I've copied this exact piece from inspect.py, I think it is better to keep it in sync (at least try to do that) 🙂

will fail with a :exc:`TypeError` if the object is a built-in module, class, or
function.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document that :func:`inspect.getdoc`, :func:`inspect.getmodule`, and
:func:`inspect.getsourcefile` might return ``None``.