@@ -6,7 +6,7 @@ type of an object at runtime. It is one of Python's strengths.
66Everything in Python is an object and we can examine those objects.
77Python ships with a few built-in functions and modules to help us.
88
9- 1. \ ``dir ``
9+ ``dir ``
1010^^^^^^^^^^^
1111
1212In 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
3333can 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
3535scope.
3636
37- 2. \ ``type `` and ``id ``
37+ ``type `` and ``id ``
3838^^^^^^^^^^^^^^^^^^^^^^^
3939
4040The ``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
7070The inspect module also provides several useful functions to get
0 commit comments