Skip to Content
Object-Oriented Python
book

Object-Oriented Python

by Irv Kalb
January 2022
Beginner to intermediate
416 pages
10h 21m
English
No Starch Press
Content preview from Object-Oriented Python

8 Encapsulation

The first of the three main tenets of object-oriented programming is encapsulation. This word might conjure up an image of a space capsule, a cell wall, or a medicine gelcap, where the precious cargo inside is protected from the outside environment. In programming, encapsulation has a similar but even more detailed meaning: hiding internal details of state and behavior from any external code and having all code in one place.

In this chapter, we’ll see how encapsulation works with functions, then with methods of objects. I’ll discuss different interpretations of encapsulation: using direct access versus using getters and setters. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Object-Oriented Programming - Fourth Edition

Python Object-Oriented Programming - Fourth Edition

Steven F. Lott, Dusty Phillips
Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel
Robust Python

Robust Python

Patrick Viafore

Publisher Resources

ISBN: 9781098129842Errata Page