November 2022
Beginner to intermediate
752 pages
19h 19m
English
This appendix is a categorized list of all the special attributes and methods in the Python language. If you’re looking for a particular special method by name, see the index instead.
Complete documentation can be found at https://docs.python.org/3/reference/datamodel.html.
These methods are declared on a class to add support for various Python operators, built-in functions, and compound statements. These are all typically declared as instance methods, unless otherwise indicated.
Table A-1: Conversion and Coercion
| Method | Typical purpose | Invocation |
obj.__bool__(self) |
Returns a boolean: ... |
Read now
Unlock full access