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

Develop #849

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

MikolaRozhansky
Copy link

No description provided.

app/main.py Outdated
Comment on lines 12 to 15
out = []

for person in people:
out.append(Person(person["name"], person["age"]))

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

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
Comment on lines 20 to 24
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"]]

Choose a reason for hiding this comment

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

Suggested change
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)

Choose a reason for hiding this comment

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

Delete print

@MikolaRozhansky
Copy link
Author

Запит 141123
Hi, How can i fix this error in code?

app/main.py Outdated
Comment on lines 12 to 13
out = []
[out.append(Person(person["name"], person["age"])) for person in people]

Choose a reason for hiding this comment

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

Suggested change
out = []
[out.append(Person(person["name"], person["age"])) for person in people]
out = [Person(person["name"], person["age"]) for person in people]

@MikolaRozhansky
Copy link
Author

Hi, How can i fix this error in code
Error
? Error on screenshot

Copy link

@YukihiroSM YukihiroSM left a 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!

@YukihiroSM
Copy link

Hi, How can i fix this error in code Error ? Error on screenshot

That's not an error, that's just Pycharm can't recognize the wife attribute of the object. That might be ignored in this case.

@MikolaRozhansky
Copy link
Author

ok. i understand

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.

3 participants