@@ -1181,6 +1181,11 @@ are always available. They are listed here in alphabetical order.
11811181 a :exc: `TypeError ` exception is raised. :exc: `TypeError ` may not be
11821182 raised for an invalid type if an earlier check succeeds.
11831183
1184+ If *object * has a ``__class__ `` attribute that differs from
1185+ :func: `type(object) <type> ` (for example a proxy, or a :mod: `unittest.mock `
1186+ object created with a *spec *), ``True `` is also returned when that class
1187+ is a subclass of *classinfo *.
1188+
11841189 .. versionchanged :: 3.10
11851190 *classinfo * can be a :ref: `types-union `.
11861191
@@ -2411,14 +2416,17 @@ are always available. They are listed here in alphabetical order.
24112416 This is an advanced function that is not needed in everyday Python
24122417 programming, unlike :func: `importlib.import_module `.
24132418
2414- This function is invoked by the :keyword: `import ` statement. It can be
2415- replaced (by importing the :mod: `builtins ` module and assigning to
2416- ``builtins.__import__ ``) in order to change semantics of the
2417- :keyword: `!import ` statement, but doing so is **strongly ** discouraged as it
2418- is usually simpler to use import hooks (see :pep: `302 `) to attain the same
2419- goals and does not cause issues with code which assumes the default import
2420- implementation is in use. Direct use of :func: `__import__ ` is also
2421- discouraged in favor of :func: `importlib.import_module `.
2419+ Eager :keyword: `import ` statements call this function.
2420+ For :ref: `lazy imports <lazy-imports >`, Python calls this function at
2421+ resolution.
2422+
2423+ You can replace :func: `__import__ ` through an assignment to
2424+ ``builtins.__import__ ``. :ref: `Import hooks <import-hooks >` usually provide a
2425+ simpler way to customize imports. A replacement can cause problems for code
2426+ that expects the default import implementation.
2427+ Do not replace :func: `__import__ ` unless import hooks cannot supply the
2428+ required behavior.
2429+ To import a module by name, use :func: `importlib.import_module `.
24222430
24232431 The function imports the module *name *, potentially using the given *globals *
24242432 and *locals * to determine how to interpret the name in a package context.
0 commit comments