-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
py-person-class solution #1605
base: master
Are you sure you want to change the base?
py-person-class solution #1605
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.
Good job!
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 code! 😊 There are a few critical issues that need to be addressed before we can approve the pull request:
-
Undefined Attributes: The code attempts to assign
husband
andwife
attributes toPerson
objects, but these attributes are not defined in thePerson
class. Please define these attributes if you intend to use them. -
Class Attribute Access: The line
self.people[name] = self
will raise an error becauseself.people
is trying to access an instance attribute that doesn't exist. You should usePerson.people[name] = self
to correctly access the class attribute. -
Shared Class Attribute: The
people
dictionary is defined as a class attribute, meaning it is shared across all instances of thePerson
class. If this is intentional, ensure that you handle it carefully to avoid unexpected behavior.
Once these issues are resolved, the code will be in great shape! Keep up the good work, and feel free 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.
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.
Review Summary
Great job on implementing the Person
class and the create_person_list
function! 🎉 Your code meets the task requirements and constraints, which is a significant achievement. However, there are a few critical issues that need attention:
-
Undefined Attributes: The code attempts to assign
husband
andwife
attributes toPerson
objects, but these attributes are not defined in thePerson
class. Make sure to define these attributes within the class to avoid potential attribute errors. -
Shared Class Attribute: The
people
dictionary is a class attribute shared across all instances. Ensure this is intentional and manage it carefully to prevent unintended side effects. -
Code Improvement: While checking for keys in dictionaries, consider using the
dict.get()
method for cleaner and more efficient code.
Overall, your solution is on the right track, and the decision to approve is made to help you move forward with your learning. Please review the comments and address the issues mentioned to enhance your code quality. Keep up the good work and continue learning from these experiences! 💪
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
Person.people[person_raw["name"]].husband \ | ||
= Person.people[person_raw["husband"]] | ||
if "wife" in person_raw.keys() and person_raw["wife"]: | ||
Person.people[person_raw["name"]].wife \ | ||
= Person.people[person_raw["wife"]] |
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 attempts to assign husband
and wife
attributes to Person
objects, but these attributes are not defined in the Person
class. You need to define these attributes within the Person
class to avoid attribute errors.
No description provided.