@@ -112,7 +112,7 @@ different, updated answers each time::
112
112
Besides showing how descriptors can run computations, this example also
113
113
reveals the purpose of the parameters to :meth: `__get__ `. The *self *
114
114
parameter is *size *, an instance of *DirectorySize *. The *obj * parameter is
115
- either *g * or *s *, an instance of *Directory *. It is *obj * parameter that
115
+ either *g * or *s *, an instance of *Directory *. It is the *obj * parameter that
116
116
lets the :meth: `__get__ ` method learn the target directory. The *objtype *
117
117
parameter is the class *Directory *.
118
118
@@ -183,7 +183,7 @@ logged, but that the regular attribute *name* is not logged::
183
183
INFO:root:Accessing 'age' giving 40
184
184
40
185
185
186
- One major issue with this example is the private name *_age * is hardwired in
186
+ One major issue with this example is that the private name *_age * is hardwired in
187
187
the *LoggedAgeAccess * class. That means that each instance can only have one
188
188
logged attribute and that its name is unchangeable. In the next example,
189
189
we'll fix that problem.
@@ -192,7 +192,7 @@ we'll fix that problem.
192
192
Customized names
193
193
----------------
194
194
195
- When a class uses descriptors, it can inform each descriptor about what
195
+ When a class uses descriptors, it can inform each descriptor about which
196
196
variable name was used.
197
197
198
198
In this example, the :class: `Person ` class has two descriptor instances,
@@ -233,7 +233,7 @@ be recorded, giving each descriptor its own *public_name* and *private_name*::
233
233
234
234
An interactive session shows that the :class: `Person ` class has called
235
235
:meth: `__set_name__ ` so that the field names would be recorded. Here
236
- we call :func: `vars ` to lookup the descriptor without triggering it::
236
+ we call :func: `vars ` to look up the descriptor without triggering it::
237
237
238
238
>>> vars(vars(Person)['name'])
239
239
{'public_name': 'name', 'private_name': '_name'}
@@ -614,8 +614,8 @@ Sometimes it is desirable for a descriptor to know what class variable name it
614
614
was assigned to. When a new class is created, the :class: `type ` metaclass
615
615
scans the dictionary of the new class. If any of the entries are descriptors
616
616
and if they define :meth: `__set_name__ `, that method is called with two
617
- arguments. The *owner * is the class where the descriptor is used, the * name *
618
- is class variable the descriptor was assigned to.
617
+ arguments. The *owner * is the class where the descriptor is used, and the
618
+ * name * is the class variable the descriptor was assigned to.
619
619
620
620
The implementation details are in :c:func: `type_new() ` and
621
621
:c:func: `set_names() ` in :source: `Objects/typeobject.c `.
@@ -703,7 +703,7 @@ Properties
703
703
----------
704
704
705
705
Calling :func: `property ` is a succinct way of building a data descriptor that
706
- triggers function calls upon access to an attribute. Its signature is::
706
+ triggers a function call upon access to an attribute. Its signature is::
707
707
708
708
property(fget=None, fset=None, fdel=None, doc=None) -> property
709
709
@@ -803,7 +803,7 @@ roughly equivalent to::
803
803
804
804
To support automatic creation of methods, functions include the
805
805
:meth: `__get__ ` method for binding methods during attribute access. This
806
- means that functions are non-data descriptors which return bound methods
806
+ means that functions are non-data descriptors that return bound methods
807
807
during dotted lookup from an instance. Here's how it works::
808
808
809
809
class Function:
@@ -1016,7 +1016,7 @@ attributes stored in ``__slots__``::
1016
1016
1017
1017
class Immutable:
1018
1018
1019
- __slots__ = ('_dept', '_name') # Replace instance dictionary
1019
+ __slots__ = ('_dept', '_name') # Replace the instance dictionary
1020
1020
1021
1021
def __init__(self, dept, name):
1022
1022
self._dept = dept # Store to private attribute
@@ -1086,7 +1086,7 @@ by member descriptors::
1086
1086
1087
1087
The :meth: `type.__new__ ` method takes care of adding member objects to class
1088
1088
variables. The :meth: `object.__new__ ` method takes care of creating instances
1089
- that have slots instead of a instance dictionary. Here is a rough equivalent
1089
+ that have slots instead of an instance dictionary. Here is a rough equivalent
1090
1090
in pure Python::
1091
1091
1092
1092
class Type(type):
0 commit comments