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

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

Conversation

RuslanKravchuk2907
Copy link

No description provided.

Comment on lines +33 to +38
# Testing
print(long_running_function(1, 2))
print(long_running_function(1, 2))
print(long_running_function(2, 3))
print(another_function(3))
print(another_function(3))

Choose a reason for hiding this comment

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

Dont push such changes

Comment on lines +8 to +15
if args in cache_storage:
print("Getting from cache")
return cache_storage[args]
else:
print("Calculating new result")
result = func(*args)
cache_storage[args] = result
return result

Choose a reason for hiding this comment

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

Try to use only 1 return



def cache(func: Callable) -> Callable:
# Write your code here
pass
cache_storage: Dict[Tuple, any] = {}

Choose a reason for hiding this comment

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

Any must be imported as type, any is a bult-in construction, not a type

pass
cache_storage: Dict[Tuple, any] = {}

def wrapper(*args) -> any:

Choose a reason for hiding this comment

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

same about any

@@ -1,6 +1,38 @@
from typing import Callable
from typing import Callable, Dict, Tuple

Choose a reason for hiding this comment

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

You already have dict and tuple in python and can use it for annotation

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