Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #1455

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #1455

wants to merge 1 commit into from

Conversation

rpk6432
Copy link

@rpk6432 rpk6432 commented Dec 14, 2024

No description provided.

Copy link

@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.

Great job on implementing the caching decorator! 🎉 Your code meets the task requirements and works as expected. Just a couple of things to keep in mind for future improvements: ensure that arguments used as keys in the cache are hashable, and consider aligning the return type annotation of the wrapper function with the function it wraps. Keep up the excellent work! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

pass
cache_store = {}

def wrapper(*args: tuple) -> Callable:

Choose a reason for hiding this comment

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

The return type annotation for the wrapper function should be the same as the return type of the func it wraps, not Callable. Consider changing it to match the return type of func.

cache_store = {}

def wrapper(*args: tuple) -> Callable:
if args in cache_store:

Choose a reason for hiding this comment

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

Using mutable types like lists or dictionaries as keys in a dictionary will raise a TypeError. Ensure that the arguments passed to the function are hashable, or consider converting them to a hashable type before using them as keys.

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