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

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

Solution #1499

wants to merge 1 commit into from

Conversation

panik10
Copy link

@panik10 panik10 commented Jan 21, 2025

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! 🎉 The code meets all the task requirements and constraints effectively. While there are a couple of minor issues, such as the misspelling of chache and a suggestion to use "".join() for cleaner cache key generation, these do not impact the functionality. Keep up the good work, and consider these suggestions for even cleaner code in the future! 😊

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


def cache(func: Callable) -> Callable:
# Write your code here
pass
chache = {}

Choose a reason for hiding this comment

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

The variable chache is misspelled. It should be cache to correctly reflect its purpose.

chache = {}

def wrapper(*args, **kwargs):
func_code = str(func.__name__) + str(args) + str(kwargs)

Choose a reason for hiding this comment

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

The comment on line 3 suggests using "".join(func.__name__, args, kwargs) for the cache key. While the current implementation using string concatenation works, using join might be cleaner and more in line with the comment.

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