Course Name: Python for Trading: Basic, Section No: 4, Unit No: 12, Unit type: Notebook
In keywords/statements the framing is different from one another.
Example: the statement new_dict.sort() - dictionaryname dot sort;
while for delete - the statment is different as del space dictionary name('KEY') and not as del.dict_name. Why dot is some cases and dot not used in some cases.
Anything like where to use dot. Please clarify.
Hi Jeyaraman
Whenever you use the syntax <object_name><dot><method> (example, my_dict.pop(<key>)), you are accessing a function specific to that data type, in your case, a dictionary. This function is called a method of the dictionary class (read, specific object) of Python and is very specific to the dictionary data type (read, specific object).
Keywords like del are available globally and not tied to only one object but to all of them.
Hope this helps.