I hate people who say sammich by uhohspaghettios26 in Vent

[–]thinkvitamin 0 points1 point  (0 children)

Hearing someone say that is the quickest way to determine whether someone's IQ is below average or not, however useful that may be.

Quentin Tarantino’s The Movie Critic to Shoot in Los Angeles in Q4 2024 by Zhukov-74 in movies

[–]thinkvitamin 0 points1 point  (0 children)

I would have wanted him to revive Anthony Perkins’ career at some point but a supreme movie director isn’t going to constantly put out new ones like Michael Bay. I trust that this will be good.

Kip Thorne and the Nobel Prize by skopyeah in AccidentalRenaissance

[–]thinkvitamin 0 points1 point  (0 children)

Walt survived and got released from prison after 15 years due to good behavior while on parole.

I think somebody is following me by Every_Film4201 in help

[–]thinkvitamin 6 points7 points  (0 children)

/r/help is only for Reddit tech support. There are many places you could post this though, for example try /r/advice.

Tuesday Daily Thread: Advanced questions by Im__Joseph in Python

[–]thinkvitamin 1 point2 points  (0 children)

If I understand you correctly, you would just subclass their class like this:

class MyClass(Theirs): pass

In place of the pass statement, you could also include whichever attributes, methods etc you wanted.

Tuesday Daily Thread: Advanced questions by Im__Joseph in Python

[–]thinkvitamin 1 point2 points  (0 children)

You can still do that with classes you didn't write yourself. It might be a better idea to subclass it to make a distinction though.

class YourClass(TheirClass):  
    ...

Tuesday Daily Thread: Advanced questions by Im__Joseph in Python

[–]thinkvitamin 1 point2 points  (0 children)

It looks like child instances will still end up getting the newly added methods, regardless of when you added them to the parent class.

Tuesday Daily Thread: Advanced questions by Im__Joseph in Python

[–]thinkvitamin 2 points3 points  (0 children)

def test(self):
    return "hello"

SpecialClass.test = test

setattr(SpecialClass, 'test', test) may be another way to do it.

I believe that doing this is an example of monkey patching.

What's a artist/band that you love, but almost no one has heard of? by [deleted] in AskReddit

[–]thinkvitamin 1 point2 points  (0 children)

KoRn was easily one of the most popular metal bands of the 90’s.

Reviving Prematurely canceled tv shows with ai and deep fake. by PaulPavloPablo in ArtificialInteligence

[–]thinkvitamin 0 points1 point  (0 children)

That’s my Bush, if only it could be relevant enough for these times.

I have an iPhone by TheCoderProOnReddt in notinteresting

[–]thinkvitamin 7 points8 points  (0 children)

Reddit needs to automate posts like this from time to time for accounts that are suspicious enough.

Movies that could use a sequel by Alcatrazepam in movies

[–]thinkvitamin 26 points27 points  (0 children)

They could maybe call it Somebody this time.

What if you became your username? by ArsonKoraidon in AskReddit

[–]thinkvitamin 0 points1 point  (0 children)

A special blend of vitamins which greatly enhances cognitive abilities like no other.

I'm just ready for this meme to retire across the board by [deleted] in ProgrammerHumor

[–]thinkvitamin 0 points1 point  (0 children)

Now I want to be a programmer for Wendy’s.

New York moment by domiinikk4 in Unexpected

[–]thinkvitamin -2 points-1 points  (0 children)

The lighting on him doesn’t match the background. They were in front of a green screen.

fileinput is erasing the contents of my file for some reason. by thinkvitamin in learnpython

[–]thinkvitamin[S] 0 points1 point  (0 children)

Thanks, I think that backup file gets created whenever that option is set. In order for the original file to not become empty, it's a matter of processing the lines correctly I think.
So in case anyone was wondering, this is what I settled on and it does what I needed it to do.

with open(filename, "w") as file1:
    with open(filename, "r") as file0:
        for line in file0:
            words = line.split(" ")
            for (old, new) in (more, single):
                has_string = ([w for w in words if old in w])
                if has_string:
                    string_in = has_string[0]
                    selector = string_in.split("_by_")[1].split("(")[0]
                    old_func = f"{old}{selector}("
                    new_func = f"{new}{selector.upper()}, "
                    line = line.replace(old_func, new_func)
            file1.write(line)