Python is an object-oriented programming language, which means it manipulates programming constructs called objects. You can think of an object as a single data structure that contains data as well as functions; functions of objects are called methods. For example, any time you call
Python is checking to see whether the string object you passed it has a length, and if it does, it returns the value associated with that attribute. When you call
Python checks to see if
my_dict has an
items() method (which all dictionaries have) and executes that method if it finds it.
But what makes
"Eric" a string and
my_dict a dictionary? The fact that they're instances of the
dict classes, respectively. A class is just a way of organizing and producing objects with similar attributes and methods.