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

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

Solution #1421

wants to merge 1 commit into from

Conversation

hecateKat
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 solution meets the task requirements effectively, and the code is well-structured. Just a small note: using frozenset for kwargs works well for hashable types, but be cautious if non-hashable types might be passed, as this could cause errors. Keep up the excellent work and consider documenting this requirement for future clarity. 😊

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


@wraps(func)
def wrapper(*args, **kwargs) -> Any:
key = (args, frozenset(kwargs.items()))

Choose a reason for hiding this comment

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

Using frozenset to create a key from kwargs is generally fine, but it assumes that all keyword arguments are hashable. If there's a possibility of non-hashable types being passed as keyword arguments, this could raise an error. Consider handling such cases or documenting this requirement.

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