Swipe to navigate through the chapters of this book
In the previous chapters, you looked at Python’s main built-in object types (numbers, strings, lists, tuples, and dictionaries); you peeked at the wealth of built-in functions and standard libraries; and you even created your own functions. Now, only one thing seems to be missing—making your own objects. And that’s what you do in this chapter.
Please log in to get access to this content
To get access to this content you need the following product:
Note that these objects need to support addition with each other. So calling add(1, 'license') would not work.
Some languages support several degrees of privacy for its member variables (attributes). Java, for example, has four different levels. Python doesn’t really have equivalent privacy support, although single and double initial underscores do to some extent give you two levels of privacy.
- More Abstraction
Magnus Lie Hetland
- Sequence number
- Chapter number
- Chapter 7