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- Terah #72

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

Conversation

terahratheheart
Copy link

OOPS, lost track of time this morning!

Comment on lines +4 to +6
def __init__(self, condition = 0):
self.category = "Decor"
self.condition = float(condition)

Choose a reason for hiding this comment

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

Another way to write this is to use super to take advantage of the code in Item's constructor:

def __init__(self, condition = 0):
    super().__init__("Decor", condition)

self.condition = float(condition)

def __str__(self):
if str(Item):

Choose a reason for hiding this comment

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

str(Item) evaluates to something like: <class 'main.Item'> so under the Python 'truthy' rules this will always evaluate to True.

Comment on lines +11 to +20
if self.condition in range(0,1):
return "it's kinda like when you take stuff to goodwill even when you know it should go in the trash but you just don't have the heart"
elif self.condition in range(1,2):
return "you're never going to have the time to fix it in the way you envision, it's going to sit in yr garage for 3 years and yr gonna get rid of it in some spring cleaning purge"
elif self.condition in range (2,3):
return "it's alright, but probably won't last much longer"
elif self.condition in range (3,4):
return "it is what it is!"
elif self.condition in range (4,5):
return "is a good find and the only reason you should pass is cuz you know you don't need another and someone else shouls have the opportunity"

Choose a reason for hiding this comment

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

I don't think range() is doing what you want it to do here. Range returns a sequence of integers from the first integer up to but not including the second integer. Consider these two code snippets:

if 5 in range(1, 6):
            print("5 in the range")

if 4.5 in range(1, 6):
            print("4.5 in the range")

The first snippet will print '5 in the range' but the second will not print anything. I think what you are trying to do is this:

if self.condition >= 0 and self.condition > 1:
            return "it's kinda like when you take stuff to goodwill even when you know it should go in the trash but you just don't have the heart"
        elif self.condition >=1 and self.condition < 2:
        ...

Comment on lines +29 to +32
self.remove(my_item)
vendor.remove(their_item)
self.add(their_item)
vendor.add(my_item)

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 +41 to +44
self.remove(my_item)
vendor.remove(their_item)
self.add(their_item)
vendor.add(my_item)

Choose a reason for hiding this comment

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

How could you use swap_items here to DRY up your code?

Comment on lines +69 to +72
they_want = self.get_best_by_category(their_priority)
my_want = other.get_best_by_category(my_priority)

self.swap_items(other, they_want, my_want)

Choose a reason for hiding this comment

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

Great use of helper functions!

@jbieniosek
Copy link

Great work on this project! I have a few minor comments about places that you can DRY up your code, but overall this is a very solid & clean project.

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