Q49: What does implementing __call__ accomplish on a class?
Implementing __call__(self, *args, **kwargs) makes instances of the class callable like standard functions (instance()). Used to maintain stateful function closures or class-based decorators.
Key Takeaways
- Makes instance objects callable like standard functions.
- Useful for stateful function decorators.
Knowledge Check
What built-in function tests whether an object instance implements the __call__ method?