-
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
Develop #849
base: master
Are you sure you want to change the base?
Develop #849
Conversation
app/main.py
Outdated
out = [] | ||
|
||
for person in people: | ||
out.append(Person(person["name"], person["age"])) |
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 list comprehension here
app/main.py
Outdated
for person in people: | ||
out.append(Person(person["name"], person["age"])) | ||
|
||
all_p = Person.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.
It's a redundant variable, you can use just Person.people
app/main.py
Outdated
if ("wife" in data) and (data["wife"] is not None): | ||
out[i].wife = all_p[data["wife"]] | ||
|
||
if ("husband" in data) and (data["husband"] is not None): | ||
out[i].husband = all_p[data["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.
if ("wife" in data) and (data["wife"] is not None): | |
out[i].wife = all_p[data["wife"]] | |
if ("husband" in data) and (data["husband"] is not None): | |
out[i].husband = all_p[data["husband"]] | |
if data.get("wife"):: | |
out[i].wife = all_p[data["wife"]] | |
if data.get("husband"): | |
out[i].husband = all_p[data["husband"]] |
app/main.py
Outdated
if ("husband" in data) and (data["husband"] is not None): | ||
out[i].husband = all_p[data["husband"]] | ||
|
||
print("out", out) |
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.
Delete print
app/main.py
Outdated
out = [] | ||
[out.append(Person(person["name"], person["age"])) for person in 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.
out = [] | |
[out.append(Person(person["name"], person["age"])) for person in people] | |
out = [Person(person["name"], person["age"]) for person in 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.
Looks good to me!
ok. i understand |
No description provided.