Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ch09-objects/e45b3_color_and_legs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ def animals_by(self, **kwargs):
return [one_animal
for one_cage in self.cages
for one_animal in one_cage.animals
if (('color' in kwargs and one_animal.color == kwargs['color']) and
('legs' in kwargs and one_animal.number_of_legs == kwargs['legs']))]
if all(key in vars(one_animal) and getattr(one_animal,key) == kwargs[key] for key in kwargs)]