-
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' #768
base: master
Are you sure you want to change the base?
'Solution' #768
Conversation
app/main.py
Outdated
def cache(func: Callable[..., Any]) -> Callable[..., Any]: | ||
results_cache = {} | ||
|
||
def wrapper(*args: Tuple, **kwargs: Any) -> Any: |
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.
kwargs is a dictionary, and you don't really need to specify types for args and kwargs here
app/main.py
Outdated
print("Calculating new result") | ||
result = func(*args, **kwargs) | ||
results_cache[key] = result | ||
return result |
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.
Try to rewrite without return duplicating
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! 🌷
No description provided.