Why naming `__call__` as `_call_impl` in module.py?

What’s the purpose to name __call__ as _call_impl in module.py?

1 Like

__call__ is a magic method in Python. If any object contains an implementation of this method, it can be invoked like a function. In this case, instead of trying to define the __call__ method, they opted to define a method _call_impl, suitably named as it is a concrete implementation, and simply set __call__ to this method. It’s a design choice and gives some flexibility as in allowing __call__ to refer to different implementations based on some condition.