-
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 #1666
base: master
Are you sure you want to change the base?
Solution #1666
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.
Great job on implementing the Person
class and the create_person_list
function! 🎉 While there are a few minor improvements suggested, such as using dict.get()
for safer dictionary access and adopting list comprehension for a more concise code, these do not impact the core functionality of your solution. Keep up the good work and consider these suggestions for future enhancements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
for person_dict in people: | ||
person = Person(name=person_dict["name"], age=person_dict["age"]) | ||
person_instances.append(person) |
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.
Consider using list comprehension to create person_instances
from people
, as recommended in the checklist. This will make the code more concise and Pythonic.
|
||
for person_dict in people: | ||
person = Person.people[person_dict["name"]] | ||
if "wife" in person_dict and person_dict["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.
Use person_dict.get('wife')
instead of checking for the key explicitly. This approach simplifies the code and avoids potential KeyError
exceptions, making it cleaner and more concise as per the checklist.
person = Person.people[person_dict["name"]] | ||
if "wife" in person_dict and person_dict["wife"]: | ||
person.wife = Person.people.get(person_dict["wife"]) | ||
if "husband" in person_dict and person_dict["husband"]: |
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.
Use person_dict.get('husband')
instead of checking for the key explicitly. This approach simplifies the code and avoids potential KeyError
exceptions, making it cleaner and more concise as per the checklist.
No description provided.