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 #557

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

Solution #557

wants to merge 3 commits into from

Conversation

sachavskyi
Copy link

No description provided.

Copy link

@Dimosphen1 Dimosphen1 left a comment

Choose a reason for hiding this comment

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

Several changes were requested.

app/main.py Outdated
Comment on lines 10 to 12
self.coords = coords
if coords is None:
self.coords = [0, 0]

Choose a reason for hiding this comment

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

Avoid such construction of assigning an attribute and instantly redefining it. You could use the conditional variable assignment or or expression.

app/main.py Outdated
Comment on lines 32 to 34
super().__init__(name, weight, coords)
if coords is None:
self.coords = [0, 0, 0]

Choose a reason for hiding this comment

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

Pass the correct coords value directly in the __init__, do not redefine it after initialization.

app/main.py Outdated
Comment on lines 55 to 56
if coords is None:
self.coords = [0, 0, 0]

Choose a reason for hiding this comment

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

Pass the correct coords value directly in the __init__, do not redefine it after initialization.

app/main.py Outdated
# write your code here

class BaseRobot:
def __init__(self, name: str, weight: int, coords: list = None) -> None:

Choose a reason for hiding this comment

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

You could be more specific in type hinting, stating that you expect a list of integers as an input to the coords here and in the other places as well.

Copy link

@Polyakiv-Andrey Polyakiv-Andrey left a comment

Choose a reason for hiding this comment

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

Good job!

app/main.py Outdated
) -> None:
self.name = name
self.weight = weight
self.coords = coords or [0, 0]

Choose a reason for hiding this comment

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

use the ternary operator here

Copy link

@Polyakiv-Andrey Polyakiv-Andrey left a comment

Choose a reason for hiding this comment

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

Good job!

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