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

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

Solution #1426

wants to merge 1 commit into from

Conversation

ruslanyemets
Copy link

No description provided.

Copy link

@taraskhom taraskhom left a comment

Choose a reason for hiding this comment

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

Все чудово, але wraps та перевірка на func_name не обов'язкова (принаймні для цих тестів)

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. While there are a couple of minor issues, such as using mutable types as dictionary keys and a mismatch in the return type annotation for compare_cash, these do not significantly impact the functionality of your code. Keep up the good work, and consider addressing these points in future projects to enhance your coding skills further! 😊

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

cash_dict = {}

@wraps(func)
def compare_cash(*args) -> dict:

Choose a reason for hiding this comment

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

The return type annotation -> dict for compare_cash is incorrect. It should match the return type of the function being decorated, which is Callable.

def compare_cash(*args) -> dict:
func_name = func.__name__

if (func_name, args) not in cash_dict:

Choose a reason for hiding this comment

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

Using args directly as a dictionary key can lead to issues if args contains mutable types, such as lists. Consider converting args to a hashable type, like a tuple of tuples, to ensure it can be used as a dictionary key.

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.

3 participants