-
Notifications
You must be signed in to change notification settings - Fork 71
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
Scissors Laurel O #57
base: master
Are you sure you want to change the base?
Conversation
|
||
class Decor(Item): | ||
def __init__(self, condition=0): | ||
super().__init__("Decor", condition) |
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.
Great use of super()!
self.inventory.remove(my_item) | ||
them.inventory.append(my_item) | ||
them.inventory.remove(their_item) | ||
self.inventory.append(their_item) |
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.
Consider using the Vendor add & remove functions here.
def swap_first_item(self, them): | ||
if len(self.inventory) == 0 or len(them.inventory) == 0: | ||
return False | ||
return self.swap_items(them, self.inventory[0], them.inventory[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.
Great code re-use!
items_in_category = self.get_by_category(category) | ||
if len(items_in_category) > 0: | ||
#lambda lets me define a func in a single line | ||
return max(items_in_category, key = lambda item: item.condition) |
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.
Neat solution! I appreciate seeing all of the different versions in your commit history.
Great work on this project! Your code is very clean and readable. I had one minor comment about a place you could DRY up your code, but otherwise your use of helper functions throughout Vendor is excellent. |
No description provided.