Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Scissors - Lindsey #69

wants to merge 2 commits into from

Conversation

lileekoi
Copy link

@lileekoi lileekoi commented Apr 7, 2021

No description provided.

return "Hello World!"

def condition_description(self):
if self.condition == 5:

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()

Comment on lines +5 to +6
self.category = "Decor"
self.condition = condition

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:

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!).

Comment on lines +32 to +35
friend.inventory.append(my_item)
self.inventory.remove(my_item)
self.inventory.append(their_item)
friend.inventory.remove(their_item)

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])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great code re-use!

Comment on lines +55 to +58
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)

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?

@jbieniosek
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants