-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
I looks like mypy drops all keyword arguments of the __call__ function of a class and recognises only positional arguments.
Code example:
class Formatter:
def __call__(
self,
message: str,
*, # same behaviour with and without
bold: bool = False,
) -> str:
if bold:
message = f"** {message} **"
return message
formatter = Formatter()
print(formatter("test", bold=True))
Mypy error:
test.py:13: error: Unexpected keyword argument "bold" for "__call__" of "Formatter"
smolcoder and shuttle1987