Real Python Tutorials

Python's .__call__() Method: Creating Callable Instances
NEW

Python's .__call__() Method: Creating Callable Instances

In this tutorial, you'll learn what a callable is in Python and how to create callable instances using the .__call__() special method in your custom classes. You'll also code several examples of practical use cases for callable instances in Python.

May 24, 2023 intermediate python