3 ms·
"callable" essentially just means you can put a "()" after the name in the code and it works. You can "call" a class. Doing so allocates an instance of that c
by Sohcahtoa82 9y ago
"callable" essentially just means you can put a "()" after the name in the code and it works.
You can "call" a class. Doing so allocates an instance of that class (Or calls the __new__ function if one is defined) and returns it, first calling the __init__ function of that class if necessary.
You can also "call" an object if its class has a __call__ function defined.
- lmm 9y agoIndeed, but isn't that exactly what "quacking like a function" is?