Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are all standard library Python interfaces documented somewhere in one place?

Tags:

python

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?

like image 298
Berislav Lopac Avatar asked Jan 26 '26 16:01

Berislav Lopac


1 Answers

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.

like image 181
kalehmann Avatar answered Jan 29 '26 06:01

kalehmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!