[New-bugs-announce] [issue45104] Error in __new__ docs

Kevin Shweh report at bugs.python.org
Sat Sep 4 18:38:45 EDT 2021


New submission from Kevin Shweh <kevin.shweh at gmail.com>:

The data model docs for __new__ say "If __new__() is invoked during object construction and it returns an instance or subclass of cls, then the new instance’s __init__() method will be invoked..."

"instance or subclass of cls" is incorrect - if for some reason __new__ returns a subclass of cls, __init__ will not be invoked, unless the subclass also happens to be an instance of cls (which can happen with metaclasses).

This should probably say something like "instance of cls (including subclass instances)", or "instance of cls or of a subclass of cls", or just "instance of cls".

----------
assignee: docs at python
components: Documentation
messages: 401065
nosy: Kevin Shweh, docs at python
priority: normal
severity: normal
status: open
title: Error in __new__ docs
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45104>
_______________________________________


More information about the New-bugs-announce mailing list