-
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
Paper, Al #61
base: master
Are you sure you want to change the base?
Paper, Al #61
Conversation
…nteract with items. Also made notes in test_wave_01.py - passed all test in wave 1.
… method, get_by_category() takes a str -category. loops, grabs matches in inventory with item.category. returns list. Passed Wave 2.
…r objects. added strigify method to item.py that returns Hello World! Passed Wave 3
…pdate as soon as I can get back to work
…d to the Vendor class. Passed all tests in Wave 6
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.
Nice work Al, you hit the learning goals here. Well done. I had a few comments, mostly on code style. Well done.
You might consider using DocStrings in your methods, to comment and document them. It might take the place of your inline methods.
def clothing_condition_description(self, condition): | ||
super().condition_description() |
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.
I don't think these methods are needed.
# the instances/obects of the Item class will be components of the Vendor class' instance - vendor objects "have many" item objects | ||
|
||
### test 2.1 PASSED ### setting the default argument makes it optional | ||
class 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.
👍
self.inventory = [] | ||
else: | ||
self.inventory = inventory | ||
# self.get_by_category = get_by_category() -- this is a Vendor method and does not need to be an attribute. |
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.
True
|
||
### test 1.1 PASSED ### test 1.2 PASSED ### | ||
class Vendor: | ||
def __init__(self, inventory = None): #get_by_category, |
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.
👍
# self.get_by_category = get_by_category() -- this is a Vendor method and does not need to be an attribute. | ||
|
||
### test 1.3 PASSED ### | ||
def add(self, 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.
👍
return remove_item | ||
|
||
### test 2.2 PASSED ### test 2.3 PASSED ### | ||
def get_by_category(self, category): |
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.
👍
#^^^returns an empty list if no item-instances belong to the category passed in. | ||
|
||
## PASSED ## test 3.2 ## test 3.3 ## test 3.4 ## test 3.5 ## test 3.6 ## | ||
def swap_items(self, friendor, my_item, 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.
👍 , but you don't need the else:
See my example further below.
else: | ||
print("something else") | ||
friendor.inventory.append(self.inventory[0]) | ||
self.inventory.remove(self.inventory[0]) | ||
self.inventory.append(friendor.inventory[0]) | ||
friendor.inventory.remove(friendor.inventory[0]) | ||
return True |
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.
You don't need the else:
here.
else: | |
print("something else") | |
friendor.inventory.append(self.inventory[0]) | |
self.inventory.remove(self.inventory[0]) | |
self.inventory.append(friendor.inventory[0]) | |
friendor.inventory.remove(friendor.inventory[0]) | |
return True | |
friendor.inventory.append(self.inventory[0]) | |
self.inventory.remove(self.inventory[0]) | |
self.inventory.append(friendor.inventory[0]) | |
friendor.inventory.remove(friendor.inventory[0]) | |
return True |
Also friendor
??
return True | ||
|
||
### test 6.1 PASSED ### test 6.2 PASSED ### test 6.3 PASSED ### | ||
def get_best_by_category(self, category): |
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.
Nice use of a lambda (sort of) function!
|
||
|
||
### test 6.4 PASSED ### test 6.5 PASSED ### test 6.6 PASSED ### | ||
def swap_best_by_category(self, other, my_priority, their_priority): |
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.
👍 Good reuse of methods!
This is my completed swap_meet project.