Fluent Python - Luciano Ramalho
Fluent Python - Luciano Ramalho (source: O'Reilly)

Pythonistas praise a good API by calling it “Pythonic.” That quality has much to do with proper use of the special methods used in the Python Data model, which define the essential behaviors that we expect in objects.

Perhaps you’ve used Python for years. Do you really know it? This tutorial is intended for a Python programmer who has working/practical knowledge of the language plus an understanding of object-oriented programming, who now needs to learn how to write idiomatic APIs. While it’s easy to get started with Python, mastering the language may take a long time. Once you understand special methods and the Python data model, you get a deeper understanding of the language. Luciano Ramalho shows how in this tutorial.

Here's a clip:


If you learned another object-oriented language before Python, you may have found it strange to call len(collection) instead of collection.len(). This apparent oddity is the tip of an iceberg that, when properly explored, is the key to everything we call Pythonic. The iceberg is called the Python data model, and it describes the API that you can use to make your own objects play well with the most idiomatic language features.

Click here to see the list of tutorials.

Article image: Fluent Python - Luciano Ramalho (source: O'Reilly).