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

add files #1649

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

add files #1649

wants to merge 1 commit into from

Conversation

bogdna21
Copy link

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 code meets most of the task requirements, there are a few critical issues that need to be addressed before we can approve it:

  1. Error Handling for Non-existent References: When setting the 'wife' and 'husband' attributes, ensure that the referenced person exists in Person.people. This will prevent potential KeyError exceptions if the name is not found. Adding error handling for these cases is crucial to ensure the robustness of your code.

  2. Unique Names in Person.people: The people dictionary is used to store references to Person objects by their names. It's important to ensure that these names are unique to avoid overwriting existing entries, which could lead to incorrect relationships between Person objects.

Please address these issues to improve the functionality and reliability of your code. Once these changes are made, we can proceed with approving your pull request. Keep up the great work, and don't hesitate to reach out if you need any help! 🚀

✨ 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,25 @@
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.

The people dictionary is used to store references to Person objects by their names. Ensure that names are unique to avoid overwriting existing entries.

persons.append(person)

for person_data in people:
person = Person.people[person_data["name"]]

Choose a reason for hiding this comment

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

Accessing Person.people using person_data["name"] assumes that the name exists in the dictionary. Consider adding error handling to manage cases where the name might not be found.

for person_data in people:
person = Person.people[person_data["name"]]
if "wife" in person_data and person_data["wife"]:
setattr(person, "wife", Person.people[person_data["wife"]])

Choose a reason for hiding this comment

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

When setting the 'wife' attribute, ensure that the referenced person exists in Person.people. Otherwise, this could lead to a KeyError if the name is not found.

if "wife" in person_data and person_data["wife"]:
setattr(person, "wife", Person.people[person_data["wife"]])
if "husband" in person_data and person_data["husband"]:
setattr(person, "husband", Person.people[person_data["husband"]])

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, ensure that the 'husband' attribute is set only if the referenced person exists in Person.people to avoid potential KeyError.

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