Reputation: 17243
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?
Upvotes: 3
Views: 83
Reputation: 5011
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.
Upvotes: 8