Skip to content

Commit 08a8f92

Browse files
committed
Merge pull request yasoob#31 from shazeline/spelling-fixes
Fix typos across all pages.
2 parents ea417e3 + ef7d163 commit 08a8f92

12 files changed

Lines changed: 20 additions & 21 deletions

__slots__magic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bottleneck. The ``dict`` wastes a lot of RAM. Python can’t just allocate
1010
a static amount of memory at object creation to store all the
1111
attributes. Therefore it sucks a lot of RAM if you create a lot of
1212
objects (I am talking in thousands and millions). Still there is a way
13-
to circumvent this issue. It involves the useage of ``__slots__`` to
13+
to circumvent this issue. It involves the usage of ``__slots__`` to
1414
tell Python not to use a dict, and only allocate space for a fixed set
1515
of attributes. Here is an example with and without ``__slots__``:
1616

classes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ its ``__init__`` method is called. For example:
160160
161161
You can see that ``__init__`` is called immediately after an instance is
162162
created. You can also pass arguments to the class during it's
163-
innitialization. Like this:
163+
initialization. Like this:
164164

165165
.. code:: python
166166

collections.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Collections
33

44
Python ships with a module that contains a number of container data
55
types called Collections. We will talk about a few of them and discuss
6-
their usefullness.
6+
their usefulness.
77

88
The ones which we will talk about are:
99

@@ -48,7 +48,7 @@ not. So we can do:
4848
# })
4949
5050
One another very important use case is when you are appending to nested
51-
ists inside a dictionary. If a ``key`` is not already present in the
51+
lists inside a dictionary. If a ``key`` is not already present in the
5252
dictionary then you are greeted with a ``KeyError``. ``defaultdict``
5353
allows us to circumvent this issue in a clever way. First let me share
5454
an example using ``dict`` which raises ``KeyError`` and then I will
@@ -84,7 +84,7 @@ sample code:
8484
2.\ ``counter``
8585
^^^^^^^^^^^^^^^
8686

87-
Counter allows us to count the occurances of a particular item. For
87+
Counter allows us to count the occurrences of a particular item. For
8888
instance it can be used to count the number of individual favourite
8989
colours:
9090

@@ -231,7 +231,7 @@ immutable.
231231
# Output: 'perry'
232232
233233
As you can see that now we can access members of a tuple just by their
234-
name using a ``.``. Let's disect it a little more. A named tuple has two
234+
name using a ``.``. Let's dissect it a little more. A named tuple has two
235235
required arguments. They are the tuple name and the tuple field\_names.
236236
In the above example our tuple name was 'Animal' and the tuple
237237
field\_names were 'name', 'age' and 'cat'. Namedtuple makes your tuples

context_managers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ generators, yield and decorators. In this example we have not caught any
162162
exceptions which might occur. It works in mostly the same way as the
163163
previous method.
164164

165-
Let's disect this method a little.
165+
Let's dissect this method a little.
166166

167167
1. Python encounters the ``yield`` keyword. Due to this it creates a
168168
generator instead of a normal function.

debugging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Debugging
22
---------
33

44
Debugging is also something which once mastered can greatly enhance your
5-
bug hunting skills. Most of the newcommers neglect the importance of the
5+
bug hunting skills. Most of the newcomers neglect the importance of the
66
Python debugger (``pdb``). In this section I am going to tell you only a
77
few important commands. You can learn more about it from the official
88
documentation.

decorators.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ other functions:
7171
7272
# This shows that whenever you call hi(), greet() and welcome()
7373
# are also called. However the greet() and welcome() functions
74-
# are not available outsite the hi() function e.g:
74+
# are not available outside the hi() function e.g:
7575
7676
greet()
7777
#outputs: NameError: name 'greet' is not defined

enumerate.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Enumerate
22
---------
33

44
Enumerate is a built-in function of Python. It's usefulness can not be
5-
summarized in a single line. Yet most of the newcommers and even some
5+
summarized in a single line. Yet most of the newcomers and even some
66
advanced programmers are unaware of it. It allows us to loop over
77
something and have an automatic counter. Here is an example:
88

exceptions.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Here is a simple example:
1515
try:
1616
file = open('test.txt', 'rb')
1717
except IOError as e:
18-
print('An IOError occured. {}'.format(e.args[-1]))
18+
print('An IOError occurred. {}'.format(e.args[-1]))
1919
2020
In the above example we are handling only the IOError exception. What
2121
most beginners do not know is that we can handle multiple exceptions.
@@ -32,7 +32,7 @@ tuple. Like so:
3232
try:
3333
file = open('test.txt', 'rb')
3434
except (IOError, EOFError) as e:
35-
print("An error occured. {}".format(e.args[-1]))
35+
print("An error occurred. {}".format(e.args[-1]))
3636
3737
Another method is to handle individual exception in a separate except
3838
block. We can have as many except blocks as we want. Here is an example:
@@ -42,10 +42,10 @@ block. We can have as many except blocks as we want. Here is an example:
4242
try:
4343
file = open('test.txt', 'rb')
4444
except EOFError as e:
45-
print("An EOF error occured.")
45+
print("An EOF error occurred.")
4646
raise e
4747
except IOError as e:
48-
print("An error occured.")
48+
print("An error occurred.")
4949
raise e
5050
5151
This way if the exception is not handled by the first except block then
@@ -78,11 +78,11 @@ for cleaning up after a script. Here is a simple example:
7878
try:
7979
file = open('test.txt', 'rb')
8080
except IOError as e:
81-
print('An IOError occured. {}'.format(e.args[-1]))
81+
print('An IOError occurred. {}'.format(e.args[-1]))
8282
finally:
8383
print("This would be printed even if no exception occurs!")
8484
85-
# Output: An IOError occured. No such file or directory
85+
# Output: An IOError occurred. No such file or directory
8686
# This would be printed even if no exception occurs!
8787
8888
``try/else`` clause

for_-_else.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This is the basic structure of a ``for/else`` loop:
4444
.. code:: python
4545
4646
for item in container:
47-
if search_comething(item):
47+
if search_something(item):
4848
# Found it!
4949
process(item)
5050
break

function_caching.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,4 @@ is a generic cache:
6969
7070
`Here <https://www.caktusgroup.com/blog/2015/06/08/testing-client-side-applications-django-post-mortem/>`__
7171
is a fine article by Caktus Group in which they caught a bug in Django
72-
which occured due to ``lru_cache``. It's an interesting read. Do check it
73-
out.
72+
which occurred due to ``lru_cache``. It's an interesting read. Do check it out.

0 commit comments

Comments
 (0)