special method
For example, the syntax obj[key] is supported by the __getitem__ special method. In order to evaluate my_collection[key], the interpreter calls my_collection.__getitem__(key).
“Dunder” is a shortcut for “double underscore before and after.”
That’s why the special methods are alson known as dunder methods.
1. Special methods supporting asynchronous programming and other new features,
added to the tables in “Overview of Special Methods” on page 15.
• Figure 1-2 showing the use of special methods in “Collection API” on page 14,
including the collections.abc.Collection abstract base class introduced in
Python 3.6.
4| Chapter 1: The Python Data Model
Also, here and throughout this second edition I adopted the f-string syntax intro‐
duced in Python 3.6, which is more readable and often more convenient than the
older string formatting notations: the str.format() method and the % operator.