Create Callable Instances With Python's .__call__()

Joseph Peart
Joseph Peart 7 Lessons 26m Jan 27, 2026 intermediate python

In Python, a callable is any object that you can call using a pair of parentheses and, optionally, a series of arguments. Functions, classes, and methods are all common examples of callables in Python. Besides these, you can also create custom classes that produce callable instances. To do this, you can add the .__call__() special method to your class.

Instances of a class with a .__call__() method behave like functions, providing a flexible and handy way to add functionality to your objects. Understanding how to create and use callable instances is a valuable skill for any Python developer.

In this video course, you’ll:

  • Understand the concept of callable objects in Python
  • Create callable instances by adding a .__call__() method to your classes
  • Compare .__init__() and .__call__() and understand their distinct roles
  • Build practical examples that use callable instances to solve real-world problems

What’s Included:

Downloadable Resources:

About Joseph Peart

Joseph is a software developer, data geek, bootcamp instructor, and board game enthusiast. He lives in Canada with his wife and cats. He loves learning new things, teaching those things to other people, and talking about himself in the third person.

» More about Joseph

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

← Browse All Courses