Skip to content

Commit b21aa27

Browse files
committed
Tidy up classes.rst
Fix a few typos and formatting inconsistencies. Also change "For instance" to "For example", a reader might be confused by two different meanings of instance close to each other in the text.
1 parent 4473bb3 commit b21aa27

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

classes.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ going!
99
1. Instance & Class variables
1010
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1111

12-
Most beginners and even some advance Python programmers do not
12+
Most beginners and even some advanced Python programmers do not
1313
understand the distinction between instance and class variables. Their
1414
lack of understanding forces them to use these different types of
1515
variables incorrectly. Let's understand them.
@@ -53,7 +53,7 @@ Let's take a look at an example:
5353
b.pi
5454
# Output: 50
5555
56-
There are not much issues while using mutable class variables. This is
56+
There are not many issues while using mutable class variables. This is
5757
the major reason due to which beginners do not try to learn more about
5858
this subject because everything works! If you also believe that instance
5959
and class variables can not cause any problem if used incorrectly then
@@ -86,11 +86,11 @@ check the next example.
8686
# Output: ['fly']
8787
8888
That is the beauty of the wrong usage of mutable class variables. To
89-
make your code safe against this kind of surprize attacks then make sure
89+
make your code safe against this kind of surprise attacks then make sure
9090
that you do not use mutable class variables. You may use them only if
9191
you know what you are doing.
9292

93-
2.New style classes:
93+
2. New style classes
9494
^^^^^^^^^^^^^^^^^^^^
9595

9696
New style classes were introduced in Python 2.1 but a lot of people do
@@ -130,16 +130,17 @@ classes.
130130
whether you subclass from ``object`` or not. However it is recommended
131131
that you still subclass from ``object``.
132132

133-
3.Magic Methods:
133+
3. Magic Methods
134134
^^^^^^^^^^^^^^^^
135135

136136
Python's classes are famous for their magic methods, commonly called
137-
**dunder** methods. I am going to discuss a few of them.
137+
**dunder** (double underscore) methods. I am going to discuss a few of
138+
them.
138139

139140
- ``__init__``
140141

141-
It is a class innitializer. Whenever an instance of a class is created
142-
it's ``__init__`` method. For instance:
142+
It is a class initializer. Whenever an instance of a class is created
143+
its ``__init__`` method is called. For example:
143144

144145
.. code:: python
145146

0 commit comments

Comments
 (0)