-
Book Overview & Buying
-
Table Of Contents
Python Illustrated
By :
This is such a cool chapter. Up until now, we’ve been working in what is called a (mostly) procedural style: we have data structures such as lists and dictionaries, and we write functions to alter and use them. There’s nothing inherently wrong with that. The procedural approach is fine for many scenarios.
But not for all! When we are working on programs that grow a little big, we might want a way to bundle data and behaviors together. And this is where classes come in. With classes, we define our own data types. We specify the data fields (attributes, sometimes called properties) and the methods for a type. Later, we can create instances of these classes (objects) to store specific data.
Working with classes allows us to move from procedural style programming to object-oriented programming. This chapter will introduce you to this concept to structure your code even more.