Читать книгу Introduction to Python Programming for Business and Social Science Applications - Frederick Kaefer - Страница 39
Objects and Classes
ОглавлениеObjects are the building blocks of Python, which is an object-oriented programming language. Objects or relations between objects represent all data in a Python program (Python Software Foundation, 2019, “Data Model”). Python classes provide all the standard features of object-oriented programming, and classes provide a means of bundling data and functionality together (Python Software Foundation, 2019, “Classes”). In other words, you use classes to create objects and objects can have functions associated with them. Classes are used to create different types of objects that have specific data types and specific actions associated with them. For example, an object can be numeric and an action that can be performed with that object is to add another number to it. A different class of object would be one that had text-based values. An action that may be associated with that type of object could be to make it all uppercase (made up of all capital letters). This action would not apply to a numeric valued object. A method is an action that you can perform to or with an object. We will explain methods in more detail in the next chapter and see examples of different methods that are used with different types of objects. To learn more about the inner workings of Python, please see The Python Language Reference found at https://docs.python.org/3/reference/index.html.