Skip to content

Conversation

@Redum9
Copy link

@Redum9 Redum9 commented Nov 4, 2025

No description provided.

Copy link

@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

Great job implementing all the required magic methods! The logic for all the operations is correct and the class works as expected.

However, I'm requesting changes because a core requirement is missing: the solution lacks type annotations. You need to add type hints to all method arguments and return values. For example, your __init__ method signature should be def __init__(self, km: int | float) -> None:.

Additionally, please add from __future__ import annotations to the top of your file. This is necessary to use Distance as a type hint within the class itself. After you add these annotations, your solution will be complete.


✨ 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

Copy link

@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

Great job adding from __future__ import annotations and implementing the core logic for the magic methods! Your solution is very close to complete. However, changes are needed because the type annotations remain incomplete, which is a primary requirement of this task.

Specifically, two things need to be addressed:

  1. Missing return types: All methods are missing their return type annotations. For example, __str__ should be -> str, __add__ should be -> Distance, and comparison methods like __lt__ should be -> bool.
  2. Incomplete parameter types: The other parameter in __add__, __iadd__, and all comparison methods should be typed as Distance | int | float to match the functionality you've implemented.

Fixing these annotations will satisfy the task requirements. You're almost there!


✨ 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

app/main.py Outdated
def __init__(self, km: int|float) -> None:
self.km = km

def __str__(self):

Choose a reason for hiding this comment

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

This method is missing its return type annotation. This violates checklist item 'Type Annotations #1': 'Use proper type annotations for function arguments and return types'. Please add the correct return type annotations for all methods that have a return value.

  • __str__ and __repr__ should be -> str.
  • __add__, __iadd__, __mul__, __truediv__ should be -> Distance.
  • Comparison methods (__lt__, __gt__, etc.) should be -> bool.

app/main.py Outdated
def __repr__(self):
return f"Distance(km={self.km})"

def __add__(self, other: int|float):

Choose a reason for hiding this comment

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

The type hint for the other parameter is incomplete. According to the task description, this method should support adding another Distance object, so the type hint should be Distance | int | float. This also applies to the __iadd__ method and all comparison methods (__lt__, __gt__, etc.).

Copy link

@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

Excellent progress on implementing the magic methods! Your logic is solid, and you're very close to a perfect solution. I am approving this submission as an educational override so you can keep moving forward, but please take a moment to review these final points on type hinting.

  • The comparison methods (__gt__, __eq__, etc.) should return bool, not Distance, as they result in a True or False value.
  • The other parameter in __add__, __iadd__, and all comparison methods should be typed as Distance | int | float to match the logic you've implemented.
  • The __repr__ method is just missing its return type annotation, which should be -> str.

Great job getting the core functionality working! Mastering these type hint details will make your code even more robust.


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

Footnotes

  1. Rate AI review example

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