Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on implementing the cache decorator! Your solution meets all the requirements perfectly, from handling various arguments to ensuring separate caches for each function. I'm approving your submission. I have one small suggestion to make the code even better: in app/main.py, the return type hint for the inner function is Callable, but it actually returns the result of the wrapped function. A more accurate type hint would be typing.Any. This is a minor point and doesn't affect the great functionality you've built. Keep up the great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| cache_history = {} | ||
|
|
||
| @functools.wraps(func) | ||
| def inner(*args, **kwargs) -> Callable: |
There was a problem hiding this comment.
The return type hint for inner is Callable, but this function actually returns the result from the wrapped function func. A Callable is something that can be called, like a function. The current hint is therefore incorrect. Consider what type hint would better represent the actual return value. The Any type from the typing module might be suitable here.
No description provided.