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

Solution #1253

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

Solution #1253

wants to merge 2 commits into from

Conversation

FursykIvan
Copy link

No description provided.

app/main.py Outdated
list[int] = None) -> None:
self.name = name
self.weight = weight
self.coords = coords if coords is not None else [0, 0]

Choose a reason for hiding this comment

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

change 'if" method to "or" method

Choose a reason for hiding this comment

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

its about "if coords is not None else"

app/main.py Outdated
Comment on lines 36 to 40
if coords is None:
coords = [0, 0, 0]
elif len(coords) == 2:
coords.append(0)
super().__init__(name, weight, coords)

Choose a reason for hiding this comment

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

you can use more simple logic.

Copy link

@AnyoneClown AnyoneClown left a comment

Choose a reason for hiding this comment

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

Good, but fix small mistake

Comment on lines +36 to +39
coords = coords or [0, 0, 0]
if len(coords) == 2:
coords.append(0)
super().__init__(name, weight, coords)

Choose a reason for hiding this comment

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

Suggested change
coords = coords or [0, 0, 0]
if len(coords) == 2:
coords.append(0)
super().__init__(name, weight, coords)
super().__init__(name=name, weight=weight, coords=coords)
self.coords = coords or [0, 0, 0]

We can refactor it like this. When you pass coords to your father class with super() it will do the same logic

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