-
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
Solution #1326
base: master
Are you sure you want to change the base?
Solution #1326
Conversation
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.
Thank you for your submission! Your code is well-structured and meets most of the task requirements. However, there are a couple of critical issues that need to be addressed before we can approve the pull request:
-
Type Safety in
bite
Method: Thebite
method should accept a parameter specifically of typeHerbivore
instead ofAnimal
. This change will ensure type safety and align with the method's logic, which is designed to interact withHerbivore
instances. -
__str__
Method Implementation: The__str__
method is typically used as an instance method to provide a string representation of an object. In your code, it seems to be used as a class method. Consider renaming it to something more descriptive, likelist_alive_animals
, or converting it to an instance method if it should represent an instance.
Once these issues are resolved, your code will be in great shape! Keep up the good work, and feel free to reach out if you have any questions. 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
app/main.py
Outdated
@classmethod | ||
def __str__(cls) -> str: | ||
return "[" + ", ".join(repr(animal) for animal in cls.alive) + "]" |
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.
The __str__
method is typically an instance method, not a class method. Consider renaming this method to something more appropriate for a class method, like list_alive_animals
, or converting it to an instance method if it should represent an instance.
app/main.py
Outdated
|
||
|
||
class Carnivore(Animal): | ||
def bite(self, herbivore: Animal) -> 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.
The bite
method should ideally accept a parameter of type Herbivore
instead of Animal
to ensure type safety, as the method logic specifically checks for Herbivore
instances.
No description provided.