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 #1383

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

Solution #1383

wants to merge 1 commit into from

Conversation

Ruslan-Ivliev
Copy link

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 effectively optimizes function calls by caching results. While there are a couple of minor issues, such as handling non-hashable return types and updating the return type hint for the wrapper function, these do not significantly impact the functionality. Keep up the good work and consider these suggestions for future improvements! 😊

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

cache_storage = {}

@wraps(func)
def wrapper(*args) -> Callable:

Choose a reason for hiding this comment

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

The wrapper function is expected to return a Callable, but it actually returns the result of the func, which may not be a Callable. Consider updating the return type hint to match the actual return type of the func.

Comment on lines +28 to +29
def long_time_func_2(n_tuple: tuple, power: int) -> int:
return [number ** power for number in n_tuple]

Choose a reason for hiding this comment

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

The long_time_func_2 function returns a list, which is not hashable and cannot be used as a cache key. Consider converting the list to a tuple before returning, or modify the caching mechanism to handle non-hashable return types.

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