@@ -1162,7 +1162,7 @@ Some object-oriented languages such as Java support interfaces,
1162
1162
declaring that a class has a given set of methods or supports a given
1163
1163
access protocol. Abstract Base Classes (or ABCs) are an equivalent
1164
1164
feature for Python. The ABC support consists of an :mod: `abc ` module
1165
- containing a metaclass called :class: `ABCMeta `, special handling of
1165
+ containing a metaclass called :class: `~abc. ABCMeta `, special handling of
1166
1166
this metaclass by the :func: `isinstance ` and :func: `issubclass `
1167
1167
builtins, and a collection of basic ABCs that the Python developers
1168
1168
think will be widely useful. Future versions of Python will probably
@@ -1172,17 +1172,17 @@ Let's say you have a particular class and wish to know whether it supports
1172
1172
dictionary-style access. The phrase "dictionary-style" is vague, however.
1173
1173
It probably means that accessing items with ``obj[1] `` works.
1174
1174
Does it imply that setting items with ``obj[2] = value `` works?
1175
- Or that the object will have :meth: `keys `, :meth: `values `, and :meth: `items `
1176
- methods? What about the iterative variants such as :meth: `iterkeys `? :meth: `copy `
1177
- and :meth: `update `? Iterating over the object with :func: `iter `?
1175
+ Or that the object will have :meth: `! keys `, :meth: `! values `, and :meth: `! items `
1176
+ methods? What about the iterative variants such as :meth: `! iterkeys `? :meth: `! copy `
1177
+ and :meth: `! update `? Iterating over the object with :func: `! iter `?
1178
1178
1179
1179
The Python 2.6 :mod: `collections ` module includes a number of
1180
1180
different ABCs that represent these distinctions. :class: `Iterable `
1181
- indicates that a class defines :meth: `__iter__ `, and
1182
- :class: `Container ` means the class defines a :meth: `__contains__ `
1181
+ indicates that a class defines :meth: `~object. __iter__ `, and
1182
+ :class: `Container ` means the class defines a :meth: `~object. __contains__ `
1183
1183
method and therefore supports ``x in y `` expressions. The basic
1184
1184
dictionary interface of getting items, setting items, and
1185
- :meth: `keys `, :meth: `values `, and :meth: `items `, is defined by the
1185
+ :meth: `! keys `, :meth: `! values `, and :meth: `! items `, is defined by the
1186
1186
:class: `MutableMapping ` ABC.
1187
1187
1188
1188
You can derive your own classes from a particular ABC
@@ -1196,7 +1196,7 @@ to indicate they support that ABC's interface::
1196
1196
1197
1197
Alternatively, you could write the class without deriving from
1198
1198
the desired ABC and instead register the class by
1199
- calling the ABC's :meth: `register ` method::
1199
+ calling the ABC's :meth: `~abc.ABCMeta. register ` method::
1200
1200
1201
1201
import collections
1202
1202
@@ -1206,10 +1206,10 @@ calling the ABC's :meth:`register` method::
1206
1206
collections.MutableMapping.register(Storage)
1207
1207
1208
1208
For classes that you write, deriving from the ABC is probably clearer.
1209
- The :meth: `register ` method is useful when you've written a new
1209
+ The :meth: `~abc.ABCMeta. register ` method is useful when you've written a new
1210
1210
ABC that can describe an existing type or class, or if you want
1211
1211
to declare that some third-party class implements an ABC.
1212
- For example, if you defined a :class: `PrintableType ` ABC,
1212
+ For example, if you defined a :class: `! PrintableType ` ABC,
1213
1213
it's legal to do::
1214
1214
1215
1215
# Register Python's types
0 commit comments