In Python standard library there is a number of implicit interfaces that are expected to be implemented in various cases. For example, coroutines and tasks are "awaitable", meaning they implement the __await__ method; context managers need to implement __enter__ and __exit__; iterables implement __next__; and so on.
Is there a single place where all those interfaces are documented, or does one need to hunt them through the documentation?
You may look for the documentation for the python data model. All the functions named by you are documentated there, for example __await__ or __enter__.
To me this is the most fascinating part of the python documentation, because this gives great insight how to max out the features of the python language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With