Chapter 3. Abstraction and encapsulation

This chapter covers

  • Understanding the value of abstraction in large systems
  • Encapsulating related code into classes
  • Using encapsulation, inheritance, and composition in Python
  • Recognizing programming styles in Python

You’ve already seen that organizing your code into functions, classes, and modules is a great way to separate concerns, but you can also use these techniques to separate complexity in your code. Because it’s difficult to remember every detail about your software at all times, in this chapter you’ll learn to use abstraction and encapsulation to create levels of granularity in your code so you can worry about the details only when you need to.

3.1. What is abstraction?

When you hear the word ...

Get Practices of the Python Pro 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.