Skip to content

Commit

Permalink
Merge pull request #31 from shazeline/spelling-fixes
Browse files Browse the repository at this point in the history
Fix typos across all pages.
  • Loading branch information
yasoob committed Aug 18, 2015
2 parents ea417e3 + ef7d163 commit 08a8f92
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion __slots__magic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bottleneck. The ``dict`` wastes a lot of RAM. Python can’t just allocate
a static amount of memory at object creation to store all the
attributes. Therefore it sucks a lot of RAM if you create a lot of
objects (I am talking in thousands and millions). Still there is a way
to circumvent this issue. It involves the useage of ``__slots__`` to
to circumvent this issue. It involves the usage of ``__slots__`` to
tell Python not to use a dict, and only allocate space for a fixed set
of attributes. Here is an example with and without ``__slots__``:

Expand Down
2 changes: 1 addition & 1 deletion classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ its ``__init__`` method is called. For example:
You can see that ``__init__`` is called immediately after an instance is
created. You can also pass arguments to the class during it's
innitialization. Like this:
initialization. Like this:

.. code:: python
Expand Down
8 changes: 4 additions & 4 deletions collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Collections

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

The ones which we will talk about are:

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

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

Expand Down Expand Up @@ -231,7 +231,7 @@ immutable.
# Output: 'perry'
As you can see that now we can access members of a tuple just by their
name using a ``.``. Let's disect it a little more. A named tuple has two
name using a ``.``. Let's dissect it a little more. A named tuple has two
required arguments. They are the tuple name and the tuple field\_names.
In the above example our tuple name was 'Animal' and the tuple
field\_names were 'name', 'age' and 'cat'. Namedtuple makes your tuples
Expand Down
2 changes: 1 addition & 1 deletion context_managers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ generators, yield and decorators. In this example we have not caught any
exceptions which might occur. It works in mostly the same way as the
previous method.

Let's disect this method a little.
Let's dissect this method a little.

1. Python encounters the ``yield`` keyword. Due to this it creates a
generator instead of a normal function.
Expand Down
2 changes: 1 addition & 1 deletion debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Debugging
---------

Debugging is also something which once mastered can greatly enhance your
bug hunting skills. Most of the newcommers neglect the importance of the
bug hunting skills. Most of the newcomers neglect the importance of the
Python debugger (``pdb``). In this section I am going to tell you only a
few important commands. You can learn more about it from the official
documentation.
Expand Down
2 changes: 1 addition & 1 deletion decorators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ other functions:
# This shows that whenever you call hi(), greet() and welcome()
# are also called. However the greet() and welcome() functions
# are not available outsite the hi() function e.g:
# are not available outside the hi() function e.g:
greet()
#outputs: NameError: name 'greet' is not defined
Expand Down
2 changes: 1 addition & 1 deletion enumerate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Enumerate
---------

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

Expand Down
12 changes: 6 additions & 6 deletions exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Here is a simple example:
try:
file = open('test.txt', 'rb')
except IOError as e:
print('An IOError occured. {}'.format(e.args[-1]))
print('An IOError occurred. {}'.format(e.args[-1]))
In the above example we are handling only the IOError exception. What
most beginners do not know is that we can handle multiple exceptions.
Expand All @@ -32,7 +32,7 @@ tuple. Like so:
try:
file = open('test.txt', 'rb')
except (IOError, EOFError) as e:
print("An error occured. {}".format(e.args[-1]))
print("An error occurred. {}".format(e.args[-1]))
Another method is to handle individual exception in a separate except
block. We can have as many except blocks as we want. Here is an example:
Expand All @@ -42,10 +42,10 @@ block. We can have as many except blocks as we want. Here is an example:
try:
file = open('test.txt', 'rb')
except EOFError as e:
print("An EOF error occured.")
print("An EOF error occurred.")
raise e
except IOError as e:
print("An error occured.")
print("An error occurred.")
raise e
This way if the exception is not handled by the first except block then
Expand Down Expand Up @@ -78,11 +78,11 @@ for cleaning up after a script. Here is a simple example:
try:
file = open('test.txt', 'rb')
except IOError as e:
print('An IOError occured. {}'.format(e.args[-1]))
print('An IOError occurred. {}'.format(e.args[-1]))
finally:
print("This would be printed even if no exception occurs!")
# Output: An IOError occured. No such file or directory
# Output: An IOError occurred. No such file or directory
# This would be printed even if no exception occurs!
``try/else`` clause
Expand Down
2 changes: 1 addition & 1 deletion for_-_else.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This is the basic structure of a ``for/else`` loop:
.. code:: python
for item in container:
if search_comething(item):
if search_something(item):
# Found it!
process(item)
break
Expand Down
3 changes: 1 addition & 2 deletions function_caching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ is a generic cache:
`Here <https://www.caktusgroup.com/blog/2015/06/08/testing-client-side-applications-django-post-mortem/>`__
is a fine article by Caktus Group in which they caught a bug in Django
which occured due to ``lru_cache``. It's an interesting read. Do check it
out.
which occurred due to ``lru_cache``. It's an interesting read. Do check it out.
2 changes: 1 addition & 1 deletion map_&_filter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ of a list of inputs we can even have a list of functions!
^^^^^^^^^

As the name suggests, filter creates a list of elements for which a
function returns true. Here is a short and consise example:
function returns true. Here is a short and concise example:

.. code:: python
Expand Down
2 changes: 1 addition & 1 deletion open_function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ to your liking (or the liking of the program that will eventually read
your file).

How do you find out which encoding a file you read has? Well,
unfortunately, there is no sureproof way to detect the encoding - the
unfortunately, there is no foolproof way to detect the encoding - the
same bytes can represent different, but equally valid characters in
different encodings. Therefore, you must rely on metadata (for example,
in HTTP headers) to know the encoding. Increasingly, formats just define
Expand Down

0 comments on commit 08a8f92

Please sign in to comment.