Summary of magic methods
We can summarize the concepts we described in the previous sections in the form of a cheat sheet like the one presented as follows. For each action in Python, the magic method involved is presented, along with the concept that it represents:
Statement | Magic method | Python concept |
|
| Subscriptable object |
|
| Context manager |
|
| Iterable object Sequence |
|
| Dynamic attribute retrieval |
|
| Callable object
|