Skip to content

Commit 760511c

Browse files
committed
updated sub section numbers
1 parent efd49f4 commit 760511c

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

decorators.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ Use-cases:
272272
Now let's take a look at the areas where decorators really shine and
273273
their usage makes something really easy to manage.
274274

275-
1. Authorization
276-
^^^^^^^^^^^^^^^^
275+
Authorization
276+
~~~~~~~~~~~~
277277

278278
Decorators can help to check whether someone is authorized to use an
279279
endpoint in a web application. They are extensively used in Flask web
@@ -295,8 +295,8 @@ authentication:
295295
return f(*args, **kwargs)
296296
return decorated
297297
298-
2. Logging
299-
^^^^^^^^^^
298+
Logging
299+
~~~~~~~~~~~~
300300

301301
Logging is another area where the decorators shine. Here is an example:
302302

for_-_else.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ like this:
2222
That is the very basic structure of a for loop. Now let's move on to
2323
some of the lesser known features of ``for`` loops in Python.
2424

25-
1.\ ``else`` clause:
25+
``else`` clause:
2626
^^^^^^^^^^^^^^^^^^^^
2727

2828
For loops also have an ``else`` clause which most of us are unfamiliar

map_&_filter.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ These are two functions which facilitate a functional approach to
55
programming. We will discuss them one by one and understand their use
66
cases.
77

8-
1. Map
8+
Map
99
^^^^^^
1010

1111
``Map`` applies a function to all the items in an input\_list. Here is
@@ -49,15 +49,15 @@ of a list of inputs we can even have a list of functions!
4949
for i in range(5):
5050
value = map(lambda x: x(i), funcs)
5151
print(value)
52-
52+
5353
# Output:
5454
# [0, 0]
5555
# [1, 2]
5656
# [4, 4]
5757
# [9, 6]
5858
# [16, 8]
5959
60-
2. Filter
60+
Filter
6161
^^^^^^^^^
6262

6363
As the name suggests, filter creates a list of elements for which a

object_introspection.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type of an object at runtime. It is one of Python's strengths.
66
Everything in Python is an object and we can examine those objects.
77
Python ships with a few built-in functions and modules to help us.
88

9-
1.\ ``dir``
9+
``dir``
1010
^^^^^^^^^^^
1111

1212
In this section we will learn about ``dir`` and how it facilitates us
@@ -20,21 +20,21 @@ example:
2020
2121
my_list = [1, 2, 3]
2222
dir(my_list)
23-
# Output: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
24-
# '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
25-
# '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__',
26-
# '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__',
23+
# Output: ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
24+
# '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
25+
# '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__',
26+
# '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__',
2727
# '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__',
28-
# '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__',
29-
# '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop',
28+
# '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__',
29+
# '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop',
3030
# 'remove', 'reverse', 'sort']
3131
3232
Our introspection gave us the names of all the methods of a list. This
3333
can be handy when you are not able to recall a method name. If we run
3434
``dir()`` without any argument then it returns all names in the current
3535
scope.
3636

37-
2.\ ``type`` and ``id``
37+
``type`` and ``id``
3838
^^^^^^^^^^^^^^^^^^^^^^^
3939

4040
The ``type`` function returns the type of an object. For example:
@@ -64,7 +64,7 @@ The ``type`` function returns the type of an object. For example:
6464
print(id(name))
6565
# Output: 139972439030304
6666
67-
3.\ ``inspect`` module
67+
``inspect`` module
6868
^^^^^^^^^^^^^^^^^^^^^^
6969

7070
The inspect module also provides several useful functions to get

0 commit comments

Comments
 (0)