-
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 #746
base: master
Are you sure you want to change the base?
Solution #746
Conversation
app/main.py
Outdated
pass | ||
cache_dict = {} | ||
|
||
def inner(*args: tuple) -> [list, int]: |
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.
Yes, inner can return not only these types, it's better to use Any
app/main.py
Outdated
pass | ||
cache_dict = {} | ||
|
||
def inner(*args: tuple) -> [list, int]: |
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.
No need to add type annotations to *args. You can use, for example, *args: int
if you want to indicate that func expects integer arguments
Fix not correct type anotation
app/main.py
Outdated
if args not in cache_dict: | ||
cache_dict[args] = func(*args) | ||
print("Calculating new result") | ||
return cache_dict[args] |
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 your decorator not to have return
duplicated
use only one 'return'
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.
Nice work! 🎈
I feel a little problem on the seventh line :))
But let`s try