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

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

Solution #1634

wants to merge 1 commit into from

Conversation

ADRIREG
Copy link

@ADRIREG ADRIREG commented Dec 12, 2024

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.


Thank you for your hard work on this Pull Request! 😊 While your solution meets most of the task requirements, there are a few critical issues that need to be addressed before we can approve it:

  1. Unique Identifier for Person Instances: The use of a class variable people to store instances of Person by name assumes that names are unique. This could lead to overwriting issues if two people have the same name. Consider using a unique identifier for each person to avoid this problem.

  2. Error Handling for wife and husband Attributes: The current implementation assumes that the wife and husband names exist in the Person.people dictionary. If a name is not found, the code will silently fail to set these attributes. Adding error handling or logging for these cases would improve the robustness of your code.

Addressing these issues will ensure that your code is both functional and reliable. Keep up the great work, and I'm confident you'll nail it with these adjustments! 🚀

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

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

@@ -1,8 +1,35 @@
class Person:
# write your code here
pass
people = {}

Choose a reason for hiding this comment

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

Using a class variable people to store instances of Person by name assumes that names are unique. If two people have the same name, the latter will overwrite the former in the dictionary. Consider using a unique identifier for each person.

Comment on lines +25 to +28
if "wife" in data and data["wife"] is not None:
wife_name = data["wife"]
if wife_name in Person.people:
person.wife = Person.people[wife_name]

Choose a reason for hiding this comment

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

The code assumes that the wife name exists in the Person.people dictionary. If the name is not found, it will silently fail to set the wife attribute. Consider adding error handling or logging to handle cases where the wife name is not found.

Comment on lines +30 to +33
if "husband" in data and data["husband"] is not None:
husband_name = data["husband"]
if husband_name in Person.people:
person.husband = Person.people[husband_name]

Choose a reason for hiding this comment

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

Similar to the wife attribute, the code assumes that the husband name exists in the Person.people dictionary. If the name is not found, it will silently fail to set the husband attribute. Consider adding error handling or logging to handle cases where the husband name is not found.

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