classification
Title: Classes created using type() don't need to explicitly inherit from object
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: boris, docs@python, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2020-04-16 17:31 by boris, last changed 2021-01-22 06:12 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19553 merged boris, 2020-04-16 17:31
PR 24295 merged miss-islington, 2021-01-22 05:47
PR 24296 merged miss-islington, 2021-01-22 05:48
Messages (4)
msg366613 - (view) Author: Борис Верховский (boris) * Date: 2020-04-16 17:31
As far as I can tell, passing `(object,)` and `()` as the `bases` parameter to the 3-argument version of type() produces the same result, because classes inherit from `object` in Python 3:

>>> type('X', (object,), dict(a=1)).__bases__
(<class 'object'>,)
>>> type('X', (), dict(a=1)).__bases__
(<class 'object'>,)

I just want to make sure I'm not missing something and update the documentation of `type()` to reflect that.
msg385478 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-01-22 05:47
New changeset 644d52818a6391535e5838fd57d58ffcb1163056 by Борис Верховский in branch 'master':
bpo-40304: Correct type(name, bases, dict) doc (GH-19553)
https://github.com/python/cpython/commit/644d52818a6391535e5838fd57d58ffcb1163056
msg385479 - (view) Author: miss-islington (miss-islington) Date: 2021-01-22 05:58
New changeset 34f3f4ac70e3ba2e603ba7792addf973c94f90cb by Miss Islington (bot) in branch '3.8':
bpo-40304: Correct type(name, bases, dict) doc (GH-19553)
https://github.com/python/cpython/commit/34f3f4ac70e3ba2e603ba7792addf973c94f90cb
msg385480 - (view) Author: miss-islington (miss-islington) Date: 2021-01-22 06:10
New changeset 98e1f5c778b9719f6338a3247da95402192bad18 by Miss Islington (bot) in branch '3.9':
bpo-40304: Correct type(name, bases, dict) doc (GH-19553)
https://github.com/python/cpython/commit/98e1f5c778b9719f6338a3247da95402192bad18
History
Date User Action Args
2021-01-22 06:12:48terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-01-22 06:10:08miss-islingtonsetmessages: + msg385480
2021-01-22 05:58:08miss-islingtonsetmessages: + msg385479
2021-01-22 05:48:00miss-islingtonsetpull_requests: + pull_request23119
2021-01-22 05:47:53miss-islingtonsetkeywords: + patch
nosy: + miss-islington

pull_requests: + pull_request23118
stage: patch review
2021-01-22 05:47:31terry.reedysetnosy: + terry.reedy
messages: + msg385478
2020-04-16 17:31:50boriscreate