Skip to content

AC2-Ocelot-Sheung Wan (Melody) Wong#10

Open
MelodyW2022 wants to merge 15 commits intoada-ac2:mainfrom
MelodyW2022:main
Open

AC2-Ocelot-Sheung Wan (Melody) Wong#10
MelodyW2022 wants to merge 15 commits intoada-ac2:mainfrom
MelodyW2022:main

Conversation

@MelodyW2022
Copy link
Copy Markdown

No description provided.

Comment thread swap_meet/item.py
class Item:
pass No newline at end of file
def __init__(self, id=None, condition=0):
if id is None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean code. This could also be a chance for a ternary operator

Comment thread swap_meet/vendor.py
class Vendor:
pass No newline at end of file
def __init__(self, inventory=None):
if inventory is None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Another example of clean, readable code, which might be more pythonic with a ternary operator.

Comment thread swap_meet/vendor.py
def add(self, item):
self.inventory.append(item)
return item
def remove(self, item):
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 detail: it's nice to see consistent white space between functions, for readability :)

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