Python has a set of built-in methods and
__call__ is one of them. The
__call__ method enables Python programmers to write classes where the instances behave like functions and can be called like a function. When the instance is called as a function; if this method is defined,
x(arg1, arg2, ...) is a shorthand for
x.__call__(arg1, arg2, ...).
object() is shorthand for object.__call__()
Instance Created Instance is called via special method
Instance Created 200
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.