Skip to content

Otters_C17 - Doina's Swap-Meet Project#87

Open
doinyco wants to merge 1 commit intoada-c17:masterfrom
doinyco:master
Open

Otters_C17 - Doina's Swap-Meet Project#87
doinyco wants to merge 1 commit intoada-c17:masterfrom
doinyco:master

Conversation

@doinyco
Copy link
Copy Markdown

@doinyco doinyco commented Apr 8, 2022

No description provided.

Copy link
Copy Markdown

@kendallatada kendallatada left a comment

Choose a reason for hiding this comment

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

Hi Doina! Your submission has been scored as green. Please check your code to see the comments I left. Let me know if you have any questions. Nice work! :)

Comment thread swap_meet/vendor.py
if self.inventory == [] or other_vendor.inventory == []:
return False

tmp = self.inventory[0]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small note - you could reuse the swap_items() method here to DRY your code

Comment thread swap_meet/vendor.py
best_item = item
return best_item

def swap_best_by_category(self, other, my_priority, their_priority):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Beautiful solution ✨

Comment thread swap_meet/item.py
category = ""
condition = 0

def __init__(self, **kwargs):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ooo! Super cool that you're using **kwargs! ✨ While you can implement the Item class this way, it is best practice to explicitly list any required attributes in the parameters rather than using **kwargs. Allowing users to pass any keyword arguments they would like leaves a lot of room for errors. This implementation would allow users to create an Item instance that doesn't have category or condition attributes, which would lead to errors in how other classes use the object. Keep that in mind going forward, but I think it's really cool you're exploring different ways to pass arguments. :)

Comment thread swap_meet/item.py
return "Hello World!"

def condition_description(self):
return str(self.condition) No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Be sure to read the requirements carefully! This function is supposed to return different descriptions based on the condition ranging from 0 to 5. (Wave 5)

also (small note), make sure to have a blank line at the end of your Python files. It's convention.

Comment thread swap_meet/clothing.py
return "The finest clothing you could wear."

def condition_description(self):
return str(self.condition) No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your Clothing class is inheriting from Item which means it automatically has the condition_description() method defined in Item, so you don't need to redefine the method in the child class. You only need to redefine the method in the child class when you want it to behave differently than the parent class's version which is called method overriding.

Comment thread swap_meet/electronics.py
return "A gadget full of buttons and secrets."

def condition_description(self):
return str(self.condition)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

note about method overriding applies here too

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