-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: master
Are you sure you want to change the base?
Solution #1426
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Все чудово, але wraps та перевірка на func_name не обов'язкова (принаймні для цих тестів)
There was a problem hiding this 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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
No description provided.