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

my decorator cash #1448

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

Conversation

shlikhta77
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 all the task requirements and handles function arguments effectively. While the use of frozenset is clever, remember to consider cases where keyword arguments might be mutable, as this could lead to a TypeError. Keep up the good work and continue refining your skills! 😊

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

cache_data = {}

def wrapper(*args, **kwargs):
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.

The use of frozenset to convert kwargs.items() into a hashable type is correct, but it assumes that all keyword arguments are hashable. If any of the keyword arguments are mutable (e.g., lists or dictionaries), this will raise a TypeError. Consider adding a check or handling for non-hashable keyword arguments.

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