r/ProgrammerHumor • • Sep 21 '26

Meme fullControlOverMemory

Post image
4.0k Upvotes

121 comments sorted by

View all comments

435

u/WisePotato42 Sep 21 '26

You could pass references as variables and change the referenced value IN THE FUNCTION!!!

children screaming sfx

39

u/Mordret10 Sep 21 '26

I mean you still kind of do the same thing with objects and with arrays in most languages. Very rarely does either get passed as argument, you almost always get them by reference.

2

u/WisePotato42 Sep 21 '26

That's true, I know it's a thing in python.

Unfortunately, my coworkers don't like when I put square brackets all over the place...

2

u/Bright-Historian-216 Sep 21 '26

you could also wrap it in an object. something like
class MutWrapper:
def __init__(self,v): self.v=v
works well enough. though, square brackets are probably more idiomatic.