Uh oh!
There was an error while loading. Please reload this page.
[Sublist] Fix existing approaches & add new ones - #4190
Conversation
also move the note about magic values into `introduction.md` and remove unverified statement about performance
Yrahcaz7
commented
May 17, 2026
@BethanyG, if I use a slightly modified version of your Sublist solution for a |
BethanyG
commented
May 17, 2026
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. 😄 |
It's pretty much the same approach, the modifications are more minor. Here's the code: SUBLIST=1SUPERLIST=2EQUAL=3UNEQUAL=4defsublist(list_one, list_two):
iflist_one==list_two:
returnEQUALifnot (list_oneandlist_two):
returnSUPERLISTiflist_oneelseSUBLISTshorter, longer=sorted((list_one, list_two), key=len)
forindexinrange(len(longer)):
iflonger[index : index+len(shorter)] ==shorter:
returnSUPERLISTiflongerislist_oneelseSUBLISTreturnUNEQUAL |
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. 😄 |
@BethanyG I ended up modifying it a bit more (mostly because I noticed it could be a bit more optimal when the arguments are Edit: Whoops, there was a copy-paste error I missed. Should be ready for real now. |
BethanyG
left a comment
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. 😄
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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 |
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? 😄
Yrahcaz7
commented
May 18, 2026
🤔 I'm feeling a little more confident this time... Maybe it's time to push the big green button! |
Uh oh!
There was an error while loading. Please reload this page.
BethanyG
commented
May 18, 2026
Smooshed and merged!! |
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.mdfor further detail.)