-
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 - Lindsey #69
base: master
Are you sure you want to change the base?
Conversation
return "Hello World!" | ||
|
||
def condition_description(self): | ||
if self.condition == 5: |
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.
This function uses self.condition, but self.condition is not initialized in init. The following code will throw an exception:
my_item = Item("Stuff")
my_item.condition_description()
self.category = "Decor" | ||
self.condition = 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.
This function is repeating some of the work that's done in the Item constructor. Consider using super().__init__(...)
as a way to DRY up code in subclasses when possible.
def condition_description(self): | ||
if self.condition == 5: | ||
return "This fit is fire" | ||
elif self.condition == 4: |
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 condition of an item can have a decimal place. What will happen if self.condition is 3.5? How could you modify these conditionals to account for that possibility? (PS: I love your descriptions!).
friend.inventory.append(my_item) | ||
self.inventory.remove(my_item) | ||
self.inventory.append(their_item) | ||
friend.inventory.remove(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, friend): | ||
if len(self.inventory) > 0 and len(friend.inventory) > 0: | ||
return self.swap_items(friend, self.inventory[0], friend.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!
my_best_cat_item = self.get_best_by_category(their_priority) | ||
their_best_cat_item = other.get_best_by_category(my_priority) | ||
if my_best_cat_item != None and their_best_cat_item != None: | ||
return self.swap_items(other, my_best_cat_item, their_best_cat_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.
Excellent use of helper functions! Question - is the error checking on line 57 needed? What happens if it's not there?
Great work on this project! Your code is very clean and readable. I had a few 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.