#callable

[ follow ]
#python
fromPythonmorsels
1 month ago
Software development

Is it a class or a function?

In Python, both classes and functions are callable; calling a class creates an instance while calling a function executes code and may return a value.
fromRealpython
1 month ago
Python

Create Callable Instances With Python's .__call__() - Real Python

Define __call__ in a class to make its instances callable, enabling objects to behave like functions for flexible, reusable behavior.
[ Load more ]