Skip to content

Solution#2255

Open
SebasDrum wants to merge 6 commits into
mate-academy:masterfrom
SebasDrum:develop
Open

Solution#2255
SebasDrum wants to merge 6 commits into
mate-academy:masterfrom
SebasDrum:develop

Conversation

@SebasDrum
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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.

Review Summary

Your cache decorator implementation is functionally correct and meets all core requirements - it properly caches results, handles different arguments, works with multiple decorated functions, and prints the correct messages. The linter violations (trailing whitespace, line length, missing newline, return type annotation) and the Spanish variable names/comment are all style issues that don't affect functionality. Your code works correctly, and the style issues can be addressed based on the linter feedback you'll receive. The implementation demonstrates good understanding of closures and decorators.


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread app/main.py Outdated
memoria = {}

def wrapper(*args, **kwargs):
# Creamos una clave única que soporte argumentos posicionales y nombrados
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove this comment before committing. Per checklist item #4.2, comments used to check solution should be deleted before pushing.

Comment thread app/main.py Outdated
# Write your code here
pass

memoria = {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using English variable names like 'cache_storage' or 'memory' instead of Spanish 'memoria' to follow the descriptive naming convention in checklist item #3.1.

Comment thread app/main.py Outdated

def wrapper(*args, **kwargs):
# Creamos una clave única que soporte argumentos posicionales y nombrados
clave = (args, tuple(sorted(kwargs.items())))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using English variable names like 'key' instead of Spanish 'clave' to follow the descriptive naming convention in checklist item #3.1.

Comment thread app/main.py Outdated
return memoria[clave]

print("Calculating new result")
resultado = func(*args, **kwargs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using English variable names like 'result' instead of Spanish 'resultado' to follow the descriptive naming convention in checklist item #3.1.

Copy link
Copy Markdown

@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.

Review Summary

Your cache decorator implementation is functionally correct and meets all core requirements. It properly caches results, handles different arguments, works with multiple decorated functions separately, and prints the correct messages. All identified issues are style and linting matters rather than functional problems. The checklist violations (Spanish variable names like memoria, clave, resultado, and Spanish comment) are style issues that do not affect code functionality. Similarly, flake8 warnings about trailing whitespace, missing return type annotation, and line length are linting concerns to be addressed in the next iteration. Since the implementation is working correctly and all remaining issues are cosmetic, the solution is approved.


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread app/main.py Outdated
# Write your code here
pass

memoria = {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable name memoria is in Spanish. The checklist requires descriptive and correct variable names in English (see Good example with list_of_numbers, result). Use memory or cache_store instead.

Comment thread app/main.py Outdated
memoria = {}

def wrapper(*args, **kwargs):
# Creamos una clave única que soporte argumentos posicionales y nombrados
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment is in Spanish. Use English comments to match the code style requirements.

Comment thread app/main.py Outdated

def wrapper(*args, **kwargs):
# Creamos una clave única que soporte argumentos posicionales y nombrados
clave = (args, tuple(sorted(kwargs.items())))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable name clave is in Spanish. Consider using key instead for consistency with English naming conventions.

Comment thread app/main.py Outdated
return memoria[clave]

print("Calculating new result")
resultado = func(*args, **kwargs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable name resultado is in Spanish. Consider using result instead.

Copy link
Copy Markdown

@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.

Review Summary

Your implementation is approved for educational purposes. The cache decorator works correctly - it properly stores and retrieves results, handles variable arguments, and maintains separate caches for different functions. Well done on the functional implementation!

However, there are style issues to address before production code:

  1. Spanish variable names - Change memoria to cache, clave to key, and resultado to result as previously flagged [CHECKLIST: Code Style #1]
  2. Trailing whitespace - Lines 5 and 7 have blank lines with whitespace (W293 lint error) - remove the trailing spaces
  3. Missing return type annotation - Add -> Callable to the wrapper function signature on line 9 (ANN201)

These are straightforward fixes that will help you develop good coding habits. Keep up the good work with the core logic!


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

Footnotes

  1. Rate AI review example

Comment thread app/main.py Outdated
# Write your code here
pass

memoria = {}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Change Spanish variable name memoria to English (e.g., cache or stored_results) - this was flagged in the previous review as a style issue

Comment thread app/main.py Outdated

def wrapper(*args, **kwargs):

clave = (args, tuple(sorted(kwargs.items())))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Change Spanish variable name clave to English (e.g., key) - this was flagged in the previous review as a style issue

Comment thread app/main.py Outdated
return memoria[clave]

print("Calculating new result")
resultado = func(*args, **kwargs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spanish variable name resultado should be changed to English (e.g., result) - this was flagged in the previous review as a style issue

Comment thread app/main.py Outdated
print("Calculating new result")
resultado = func(*args, **kwargs)
memoria[clave] = resultado
return resultado
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spanish variable name resultado should be changed to English (e.g., result) - this was flagged in the previous review as a style issue

Sebastián A. Estrada added 3 commits May 28, 2026 17:38
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