STYLE: fix violation of the DRY principle#154
Conversation
52e92d9 to
5ded808
Compare
cretz
left a comment
There was a problem hiding this comment.
Sometimes in samples we intentionally copy code as a demonstration of what a user might do if they had different code for each conditional. For example, if we really wanted to properly reuse code, we wouldn't have 4 separately named activities, we'd have one order_fruit activity that accepted a fruit type.
But I am ok with this. @dandavison - opinion?
|
Nice cleanup @drveles. I agree -- while the activity calls are all the same it's appropriate for them to be written without repetition. |
| @@ -59,39 +59,22 @@ async def run(self, list: ShoppingList) -> str: | |||
| ordered: List[str] = [] | |||
| for item in list.items: | |||
There was a problem hiding this comment.
A tiny thing, not related to this PR, but we should avoid using list as a variable name in Python.
|
Thank you. |
What was changed
The code has been updated in accordance with the DRY principle.
Why?
It is much smaller, more concise and faster to read.
Closes
How was this tested:
Standard tests must pass.
Any docs updates needed?
No. The logic has not been changed.