-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
Solution #1634
Conversation
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.
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:
-
Unique Identifier for
Person
Instances: The use of a class variablepeople
to store instances ofPerson
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. -
Error Handling for
wife
andhusband
Attributes: The current implementation assumes that thewife
andhusband
names exist in thePerson.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 = {} |
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.
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.
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] |
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.
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.
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] |
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.
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.
No description provided.