A simple decorator written as a class, which counts how many times a function has been called

Can I improve its typing? Is there any other improvement or pythonic change that you would do?

F = TypeVar('F', bound=Callable[..., Any])   # This is mostly so that I practice using a class as a decorator. class CountCalls:     """Logs to DEBUG how many times a function gets called, saves the result in a newly created attribute `num_calls`."""     def __init__(self, func: F) -> None:         functools.update_wrapper(self, func)         self.func = func         self.num_calls: int = 0         self._logger = logging.getLogger(__name__ + '.' + self.func.__name__)         self.last_return_value = None      def __call__(self, *args: Any, **kwargs: Any) -> Any:         self.num_calls += 1         self._logger.debug(' called %s times', self.num_calls)         self.last_return_value = self.func(*args, **kwargs)         return self.last_return_value 

Here’s the decorator in action:

@CountCalls def asdf(var: str):     print(var)     return len(var) asdf(5) Traceback (most recent call last):   File "<input>", line 1, in <module>   File "C:/Projects/Python/he/src/he/decorators.py", line 139, in __call__     self.last_return_value = self.func(*args, **kwargs)   File "<input>", line 4, in asdf TypeError: object of type 'int' has no len() 5 asdf('Laur') Laur 4 asdf.last_return_value 4 asdf('fake gangsta') fake gangsta 12