What Defines a Callable Type in Python

Great points so far! But here’s something even more interesting—classes themselves are callable.

Why? Because the type class defines __call__.

class Example:
    pass

print(callable(Example))  # True ✅

This means when you do Example(), Python actually calls Example.__call__(), which is defined in type. That’s how instances are created! :rocket:

Similarly, built-in functions like max are callable:

print(callable(max))  # True ✅

So, in summary:

:heavy_check_mark: Functions & Methods → Callable (Because of __call__)

:heavy_check_mark: Instances → Callable if they define __call__

:heavy_check_mark: Classes → Callable (Because type has __call__)

:x: Static & Class Methods → Not callable (They wrap callables, but aren’t directly callable)

And that’s the complete picture of the Python callable type! :dart: