Skip to Content
Python Distilled
book

Python Distilled

by David M. Beazley
September 2021
Beginner to intermediate
352 pages
11h 27m
English
Addison-Wesley Professional
Content preview from Python Distilled

4. Objects, Types, and Protocols

Python programs manipulate objects of various types. There are a variety of built-in types such as numbers, strings, lists, sets, and dictionaries. In addition, you can make your own types using classes. This chapter describes the underlying Python object model and mechanisms that make all objects work. Particular attention is given to the “protocols” that define the core behavior of various objects.

4.1 Essential Concepts

Every piece of data stored in a program is an object. Each object has an identity, a type (also known as its class), and a value. For example, when you write a = 42, an integer object is created with the value of 42. The identity of the object is a number representing its location in memory; ...

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 Testing with pytest

Python Testing with pytest

Brian Okken
Robust Python

Robust Python

Patrick Viafore

Publisher Resources

ISBN: 9780134173399