Skip to content

Commit 6b16d93

Browse files
nanjekyejoannahrhettinger
authored andcommitted
bpo-15542: Documentation incorrectly suggests __init__ called after direct __new__ call (GH-15478)
1 parent 1039f39 commit 6b16d93

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/reference/datamodel.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1166,10 +1166,10 @@ Basic customization
11661166
with appropriate arguments and then modifying the newly-created instance
11671167
as necessary before returning it.
11681168

1169-
If :meth:`__new__` returns an instance of *cls*, then the new instance's
1170-
:meth:`__init__` method will be invoked like ``__init__(self[, ...])``, where
1171-
*self* is the new instance and the remaining arguments are the same as were
1172-
passed to :meth:`__new__`.
1169+
If :meth:`__new__` is invoked during object construction and it returns an
1170+
instance or subclass of *cls*, then the new instance’s :meth:`__init__` method
1171+
will be invoked like ``__init__(self[, ...])``, where *self* is the new instance
1172+
and the remaining arguments are the same as were passed to the object constructor.
11731173

11741174
If :meth:`__new__` does not return an instance of *cls*, then the new instance's
11751175
:meth:`__init__` method will not be invoked.

0 commit comments

Comments
 (0)