mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Remove unnecessary object base class in docs (#10366).
Also add a note about inheritance from `object` being default.
This commit is contained in:
parent
d4bbab278f
commit
28053fb174
13 changed files with 26 additions and 17 deletions
|
|
@ -561,7 +561,16 @@ A class definition defines a class object (see section :ref:`types`):
|
|||
A class definition is an executable statement. The inheritance list usually
|
||||
gives a list of base classes (see :ref:`metaclasses` for more advanced uses), so
|
||||
each item in the list should evaluate to a class object which allows
|
||||
subclassing.
|
||||
subclassing. Classes without an inheritance list inherit, by default, from the
|
||||
base class :class:`object`; hence, ::
|
||||
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
is equivalent to ::
|
||||
|
||||
class Foo(object):
|
||||
pass
|
||||
|
||||
The class's suite is then executed in a new execution frame (see :ref:`naming`),
|
||||
using a newly created local namespace and the original global namespace.
|
||||
|
|
|
|||
|
|
@ -1987,7 +1987,7 @@ to work correctly if defined on an object's type, not in the object's instance
|
|||
dictionary. That behaviour is the reason why the following code raises an
|
||||
exception::
|
||||
|
||||
>>> class C(object):
|
||||
>>> class C:
|
||||
... pass
|
||||
...
|
||||
>>> c = C()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue