Skip to content

Commit 8d867cb

Browse files
committed
Closes python#17057: fix grammar in old-style vs new-style class docs.
1 parent ff05e52 commit 8d867cb

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎Doc/reference/datamodel.rst‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,18 +1117,19 @@ New-style and classic classes
11171117

11181118
Classes and instances come in two flavors: old-style (or classic) and new-style.
11191119

1120-
Up to Python 2.1, old-style classes were the only flavour available to the user.
1121-
The concept of (old-style) class is unrelated to the concept of type: if *x* is
1122-
an instance of an old-style class, then ``x.__class__`` designates the class of
1123-
*x*, but ``type(x)`` is always ``<type 'instance'>``. This reflects the fact
1124-
that all old-style instances, independently of their class, are implemented with
1125-
a single built-in type, called ``instance``.
1126-
1127-
New-style classes were introduced in Python 2.2 to unify classes and types. A
1128-
new-style class is neither more nor less than a user-defined type. If *x* is an
1129-
instance of a new-style class, then ``type(x)`` is typically the same as
1130-
``x.__class__`` (although this is not guaranteed - a new-style class instance is
1131-
permitted to override the value returned for ``x.__class__``).
1120+
Up to Python 2.1 the concept of ``class`` was unrelated to the concept of
1121+
``type``, and old-style classes were the only flavor available. For an
1122+
old-style class, the statement ``x.__class__`` provides the class of *x*, but
1123+
``type(x)`` is always ``<type 'instance'>``. This reflects the fact that all
1124+
old-style instances, independent of their class, are implemented with a single
1125+
built-in type, called ``instance``.
1126+
1127+
New-style classes were introduced in Python 2.2 to unify the concepts of
1128+
``class`` and ``type``. A new-style class is simply a user-defined type,
1129+
no more, no less. If *x* is an instance of a new-style class, then ``type(x)``
1130+
is typically the same as ``x.__class__`` (although this is not guaranteed -- a
1131+
new-style class instance is permitted to override the value returned for
1132+
``x.__class__``).
11321133

11331134
The major motivation for introducing new-style classes is to provide a unified
11341135
object model with a full meta-model. It also has a number of practical
@@ -1155,8 +1156,7 @@ sources of additional information.
11551156
single: class; classic
11561157
single: class; old-style
11571158

1158-
Old-style classes are removed in Python 3, leaving only the semantics of
1159-
new-style classes.
1159+
Old-style classes are removed in Python 3, leaving only new-style classes.
11601160

11611161

11621162
.. _specialnames:

0 commit comments

Comments
 (0)