1
Introduction to Objects
Classes are one of the most important parts of the Python language and also a major component of object-oriented programming. Some books put off classes until later chapters, but because nearly every component of Python is an object, we will take a look at them up right away. And don’t skip ahead, because we’ll be using them in every single chapter that follows!
Almost every component of Python is an object.
Objects hold data and have methods to access and change that data.
For example, strings, lists, tuples, sets, and dictionaries are all objects, as are complex numbers. They all have functions associated with them called methods that enable you to get and change that data.
list1 = ...
Get Python Programming with Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.