Skip to content

Solution#2182

Open
ViperAF1 wants to merge 1 commit intomate-academy:masterfrom
ViperAF1:develop
Open

Solution#2182
ViperAF1 wants to merge 1 commit intomate-academy:masterfrom
ViperAF1:develop

Conversation

@ViperAF1
Copy link
Copy Markdown

@ViperAF1 ViperAF1 commented Apr 4, 2026

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

Comment thread app/main.py
cache_history = {}

@functools.wraps(func)
def inner(*args, **kwargs) -> Callable:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants