-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Title #1211
base: master
Are you sure you want to change the base?
Title #1211
Conversation
app/main.py
Outdated
class FlyingRobot(BaseRobot): | ||
def __init__(self, name: str, weight: int, coords: list = None) -> None: | ||
coords = coords or [0, 0, 0] | ||
super().__init__(name, weight, coords) |
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.
Instead coords = coords or [0, 0, 0]
, directly set coords=coords or [0, 0, 0]
into init method
coords: list = None | ||
) -> None: | ||
coords = coords or [0, 0, 0] | ||
super().__init__(name, weight, coords) |
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.
Same here as well
app/main.py
Outdated
|
||
class BaseRobot: | ||
def __init__(self, name: str, weight: int, coords: list = None) -> None: | ||
coords = coords or [0, 0] |
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.
coords = coords or [0, 0] | |
self.coords = coords or [0, 0] |
app/main.py
Outdated
coords = coords or [0, 0] | ||
self.name = name | ||
self.weight = weight | ||
self.coords = coords |
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.
And you can remove this
app/main.py
Outdated
self.coords = coords or [0, 0, 0] | ||
super().__init__(name, weight, self.coords) |
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.
self.coords = coords or [0, 0, 0] | |
super().__init__(name, weight, self.coords) | |
super().__init__(name, weight, coords or [0, 0, 0]) |
app/main.py
Outdated
self.coords = coords or [0, 0, 0] | ||
super().__init__(name, weight, self.coords) |
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.
self.coords = coords or [0, 0, 0] | |
super().__init__(name, weight, self.coords) | |
super().__init__(name, weight, coords) |
Since parent class will do the same
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.
LGTM!
No description provided.