Solution#2250
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your cache decorator implementation is solid and meets all core functional requirements. Caching works correctly with variable arguments, maintains separate caches per function, returns cached results for repeated calls, and properly prints the required messages. The return type annotation -> int on the wrapper function is a minor type-checking concern rather than a functional blocker. While the code runs correctly at runtime (Python doesn't enforce type hints), this annotation could cause static type checkers like mypy to flag errors if the decorated function returns a different type like a list. Consider either removing the annotation or using -> Any from the typing module if you want to keep the decorator's type hints accurate. Overall, the implementation is clean, efficient, and production-ready for the task requirements. Great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| # Write your code here | ||
| pass | ||
| @wraps(func) | ||
| def wrapper_cache(*args) -> int: |
There was a problem hiding this comment.
The return type annotation -> int is incorrect. Since the decorator should work with any function (e.g., functions returning lists as shown in the example), the wrapper's return type should be more generic or omitted.
No description provided.