| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
also move the note about magic values into `introduction.md` and remove unverified statement about performance
|
@BethanyG, if I use a slightly modified version of your Sublist solution for a sort-lists approach, should I add you in the contributors array for that approach? I'm still not sure how all this authors and contributors array stuff works. |
Sorry, something went wrong.
If that modification has lead to a whole new approach, I'd just put yourself as the author. I am happy being left off. My name is next to so much stuff, no need to invent more. 😄 |
Sorry, something went wrong.
|
It's pretty much the same approach, the modifications are more minor. Here's the code: SUBLIST = 1
SUPERLIST = 2
EQUAL = 3
UNEQUAL = 4
def sublist(list_one, list_two):
if list_one == list_two:
return EQUAL
if not (list_one and list_two):
return SUPERLIST if list_one else SUBLIST
shorter, longer = sorted((list_one, list_two), key=len)
for index in range(len(longer)):
if longer[index : index + len(shorter)] == shorter:
return SUPERLIST if longer is list_one else SUBLIST
return UNEQUAL |
Sorry, something went wrong.
|
still happy being left off. 😄 It's all yours! Edited to add: Needed a bit of a break, so have been doing some knitting. So I might be a tad slower to answer for a bit. Will get back to things in a bit. 😄 |
Sorry, something went wrong.
|
@BethanyG I ended up modifying it a bit more (mostly because I noticed it could be a bit more optimal when the arguments are UNEQUAL). The PR should ready for review now. Edit: Whoops, there was a copy-paste error I missed. Should be ready for real now. |
Sorry, something went wrong.
There was a problem hiding this comment.
Only putting in request changes so that we discuss this a bit more. Overall, this is looking really good. I just want to make sure we are really clear with that PyLint rule and the explanation in the helper function approach. 😄
Sorry, something went wrong.
Co-authored-by: BethanyG <BethanyG@users.noreply.github.com>
…cleanup-and-new' into sublist-approaches-cleanup-and-new
|
Uh... Git went a little weird there because I forgot to pull origin before making more changes. Hopefully I didn't break anything? |
Sorry, something went wrong.
There was a problem hiding this comment.
Uh... Git went a little weird there because I forgot to pull origin before making more changes. Hopefully I didn't break anything?
It doesn't look like it to me....I can still see all the files and changes and there doesn't appear to be any duplicates or merge conflicts.
Nice work you! Shall we let this sit and re-review, or are you ready to push the big, green button? 😄
Sorry, something went wrong.
|
🤔 I'm feeling a little more confident this time... Maybe it's time to push the big green button! |
Sorry, something went wrong.
|
Smooshed and merged!! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes formatting and content of Sublist approaches as outlined here. (Will add at least one additional approach.)
Looking closer at the argument in this PR, I have have to say that I don't fully agree with either side. (Look at the changes in using-strings/content.md for further detail.)