-
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 #562
solution #562
Conversation
app/main.py
Outdated
print("The slippers delivered!") | ||
|
||
|
||
def feed_animals(animal_list: list) -> 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.
- rename animal_list to animals
- add inner type to annotation. list[Animal]
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.
Please explain how to use: list[Animal] or list[Animal | Cat | Dog ]
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.
Better to use list[Animal] it already means that will work with all child classes
app/main.py
Outdated
|
||
|
||
def feed_animals(animal_list: list) -> int: | ||
return sum([animal.feed() for animal in animal_list]) |
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.
return sum([animal.feed() for animal in animal_list]) | |
return sum(animal.feed() for animal in animal_list) |
Convert to list is redundant
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.
Changes requested
No description provided.