-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #751
base: master
Are you sure you want to change the base?
Solution #751
Conversation
app/main.py
Outdated
def __init__(self, name: str, health: int = 100) -> None: | ||
self.name = name | ||
self.health = health | ||
self.hidden = False |
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.
Don't hardcode the value for self.hidden. add it to parameters
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.
One minor change was requested.
app/main.py
Outdated
|
||
|
||
class Carnivore(Animal): | ||
def bite(self, herbivore: int) -> None: |
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.
Change your type annotation, herbivore
should not be int
.
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.
Several changes were requested.
app/main.py
Outdated
|
||
|
||
class Carnivore(Animal): | ||
def bite(self, herbivore: "Herbivore") -> None: |
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.
Do not use quotes ""
in type annotations, declare class directly to indicate that you expect its instance as an input. Use from __future__ import annotations
in case you face issues with this syntaxis.
app/main.py
Outdated
self, | ||
name: str, | ||
health: int = 100, | ||
hidden: bool = False |
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.
Indicate in type annotation that health
and hidden
are optional arguments.
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, well done!
No description provided.