[issue40304] Classes created using type() don't need to explicitly inherit from object
New submission from Борис Верховский <boris.verk@gmail.com>: 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. ---------- assignee: docs@python components: Documentation messages: 366613 nosy: boris, docs@python priority: normal pull_requests: 18902 severity: normal status: open title: Classes created using type() don't need to explicitly inherit from object type: enhancement versions: Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
Terry J. Reedy <tjreedy@udel.edu> added the comment: New changeset 644d52818a6391535e5838fd57d58ffcb1163056 by Борис Верховский in branch 'master': bpo-40304: Correct type(name, bases, dict) doc (GH-19553) https://github.com/python/cpython/commit/644d52818a6391535e5838fd57d58ffcb11... ---------- nosy: +terry.reedy _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- keywords: +patch nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +23118 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24295 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +23119 pull_request: https://github.com/python/cpython/pull/24296 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: 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/34f3f4ac70e3ba2e603ba7792addf973c94... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: 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/98e1f5c778b9719f6338a3247da95402192... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
Change by Terry J. Reedy <tjreedy@udel.edu>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue40304> _______________________________________
participants (3)
-
miss-islington
-
Terry J. Reedy
-
Борис Верховский