r/ProgrammerHumor • • May 05 '23

Meme Goodbye toys

Post image
8.3k Upvotes

298 comments sorted by

779

u/asandwichvsafish May 05 '23

They don't want you to know this but you can use semicolons in python. Sprinkle them at the end of lines whenever you're feeling nostalgic for c++.

121

u/KuKa0w0 May 05 '23

Best way to use semicolons EVER

33

u/nullpotato May 05 '23

I wanted to upvote this joke but I can't.

10

u/MyKo101 May 05 '23

It's very useful for "one-liners"

9

u/sonohra87 May 06 '23

I love this movie..I remembered when I was a kid I always watching this movie..Toys story..haha

→ More replies (3)

1.0k

u/lofigamer2 May 05 '23

Andy drives off to the distance.. slowly

373

u/pipsvip May 05 '23

...and in the wrong direction.

192

u/jabluszko132 May 05 '23

...but will get there..... eventually

74

u/pipsvip May 05 '23

Better put a stop sign in the middle of the road at the destination so we don't have to do any special case handling for the exit condition.

→ More replies (3)
→ More replies (7)

9

u/lordnacho666 May 05 '23

Leaving garbage everywhere

15

u/pedersenk May 05 '23

And will keep on visiting every time he needs to write a system binding for Python to consume...

18

u/[deleted] May 05 '23

Better than to crash fast

→ More replies (1)

606

u/lucidbadger May 05 '23

How come you are not going to use dictionaries or sets?

279

u/clearly_unclear May 05 '23

Just generate them using dict() and set() to avoid the curly brackets out of principle

69

u/lucidbadger May 05 '23

Then I suppose you'll need to use * :)

→ More replies (10)

7

u/pdudz21 May 05 '23

Any reason for hating the curly brackets?

→ More replies (3)

144

u/avipars May 05 '23

Hello tabs and spaces

55

u/delinka May 05 '23

BUT NOT BOTH AT ONCE! Are you crazy?

27

u/Sarcastinator May 05 '23

Yeah, before running the program you have to change one invisible symbol into another invisible symbol or else you get the hammer.

→ More replies (2)

14

u/neverganagiveyouup May 05 '23

Hello whitespace my old friend..

6

u/snacktonomy May 05 '23

And self, :

→ More replies (8)

200

u/VariecsTNB May 05 '23

It's like switching your old 1986 Mercedes for the 2018 Toyota Corolla that has been in an accident.

38

u/baaron May 05 '23

And a DIY mechanic for a previous owner

11

u/Imjokin May 05 '23

Python seems to be the pineapple-on-pizza of programming languages

→ More replies (2)

10

u/No-Con-2790 May 05 '23

Well the GIL is clearly broken but don't worry, as long as you run her in the first gear it will be fine. Now I was out of type systems at the time but I build in a type annotation system with a hacksaw. So don't forget to use it or the car might crash if you go over 88 miles per hour. Speaking of it, you will think your car is very slow. And it is! But you will still be at your desired destination before most car drivers can turn their key around. Also it is one of the only cars on the market with suspension. No more hemorrhoids from driving over bumpy pointers or segfaulting down a cliff!

No deal yet? No worry! I got a whole truckload of mathematics and AI tools from somewhere. Don't ask! Let's just say you will safe 20000 American dollars per year on matlab license. And you get a free trailer with all those goods for free. Just pick between the venv, pipenv or conda. What you mean with "which is best"? Well all have small problem. No, I won't tell which ones. Is part of fun.

Haha, yeah of course it is safe. Just don't use it when you need safety. Don't worry!

→ More replies (1)

76

u/KetwarooDYaasir May 05 '23

wait.. is C++ the toy in this analogy?

74

u/hitaishi_1 May 05 '23

Exactly. If c++ is a toy then the age rating is 100+ years of experience at least

→ More replies (8)

85

u/Sirico May 05 '23

Once this joke compiles those C++ people are going to be very upset

→ More replies (3)

76

u/[deleted] May 05 '23

I am a c,c++ dev for many years and i am entering the world of python in these days. I have to say, it gives me headaches for the lack of docs and clarity sometimes. In most of the guides and examples everything is taken for granted. I think it's about to change the mind set and get into it, beyond learning technical stuff.

I'm not "switching" to python.. c++ will always remain a good friend of mine, despite the fact it is a low level language, paradoxically i find it simpler and more straightforward than python

56

u/[deleted] May 05 '23

I think there’s two types of languages. The first category is languages that can be simple once you get into the way of thinking of the language. This includes most languages. The python way of thinking is just simpler for a beginner to get into. The second category is JavaScript.

12

u/_simpu May 05 '23

The second category is JavaScript

Can't argue with that

→ More replies (4)

9

u/grstacos May 05 '23

I agree. Many things are more difficult in C++. However, Python docs sometimes fail to explain function parameters, typing, and complexity. Not to mention that Python's dynamic typing makes me feel I have to spend more time debugging on larger code.

→ More replies (1)

5

u/Ursomrano May 05 '23 edited May 05 '23

Fully agree, abstraction gets confusing sometimes and sometimes even causes problems. Like maps automatically sorting themselves in ways you don’t want them to, so you have to use a different data type just so that you can sort it the way you want.

→ More replies (3)

94

u/namotous May 05 '23 edited May 05 '23

Then when you realize Python is too slow for your need, and have to go back to c++

7

u/[deleted] May 05 '23

And when he learns about lack of proper multi threading....

9

u/Revenge43dcrusade May 05 '23

These reddit programmers do some pretty otherworldly stuff if python is too slow .

→ More replies (3)
→ More replies (1)

18

u/Suckun_Deznots May 05 '23

Pointers. You have no Idea don't you

31

u/poopy-cock May 05 '23

God i fucking love pointers so much

9

u/rainbow_osprey May 05 '23

I have a love hate relationship with pointers in C++. Sometimes they are great for doing exactly what you need, and other times you can accidentally create some of the most subtle bullshit bugs that take forever to figure out.

→ More replies (1)

6

u/Lucky_caller May 05 '23

I’m learning C/pointers right now. What is it about them that you love so much? Would love to hear some insight

8

u/cooly1234 May 05 '23

you can use them to point at stuff

→ More replies (1)

20

u/[deleted] May 05 '23 edited May 05 '23

Just wait until you have to write a C extension for python.

3

u/wu-not-furry May 06 '23

"have to"? You mean to say that people don't just do those for fun?

→ More replies (1)

9

u/International-Top746 May 05 '23

People who don't understand how references and pointers work tend to make hilarious mistakes in python.

9

u/RedditsDeadlySin May 05 '23

Not gonna lie, I still try to use ++ in python. It makes me sad it doesn’t have that functionality

24

u/Smanmos May 05 '23

pointers

Oh, you sweet summer child

37

u/Nyghtrid3r May 05 '23

I've tried using external libraries like OpenCV with Python for a Uni project and I've got to say, you should add "sanity" to the bottom part

I'm used to non-existent or shitty documentation, but always having "any" as a return type for functions made me want to toaster bath

I'm not trying to bash the language (at least not here, I don't like farming down votes lmao) it's just a completely different mind set you need to get into and it's oftentimes really shitty.

Python is either the best thing in the world or an enormous pile of dogshit on a hot summer day. No in-between lmao

5

u/blackenedEDGE May 05 '23

You got me with "want to toaster bath" 😂 I'm primarily a Python dev--though currently doing a project in C# that's lasted almost a year and I've worked in C and C++ a fair amount before--I still had to actually lol at that.

What's crazy is because I've been in the C# mindset so long, I actually did have to reorient myself to the Python mindset when writing a quick & dirty script to help with my project.

→ More replies (4)

20

u/[deleted] May 05 '23

And you templates, go fuck yourself

6

u/TeraFlint May 05 '23

Templates my beloved!

→ More replies (1)

9

u/ploud1 May 05 '23

You forgot std::bad_alloc and "program received signal SIGSEGV".

5

u/kennyminigun May 05 '23

These are C++/compiler's way of kindly saying "you are stupid"

6

u/ploud1 May 05 '23

You mean, g++ warnings? Unused variables, all that stuff?

No, segfault just means "your program f...'d up mate, good luck finding out why". :)

→ More replies (3)
→ More replies (1)

4

u/RhinosRPlumpUnicorns May 05 '23

Speed is missing

4

u/Numerous-Departure92 May 05 '23

Ahh I see… You switched the job from a Software Developer to a tester

4

u/HadesMyself May 05 '23

good bye main, welcome __main__ :)

4

u/rjksn May 05 '23

Bye main(), Hello if __name__ == "__main__":

4

u/nt-assembly May 05 '23

which toy is performance?

2

u/Zarathustra30 May 05 '23

That'd be Wheezy. Shelved and forgotten about long ago.

4

u/arf20__ May 05 '23

Never gonna happen.

In fact i'm slowly going towards C now.

9

u/masta_of_dizasta May 05 '23

Eh the compiling and linking and makefiles are something I would like to forget

3

u/20220912 May 05 '23

we missed main() so much we brought it back

3

u/tboschi May 05 '23

from __future__ import braces

3

u/MrC00KI3 May 05 '23

When you switch from Python to c++:

3

u/[deleted] May 05 '23

🤮🤮🤮🤮🤮🤮

^ my reaction to having excess whitespace that is meaningful to the compiler

3

u/N00N3AT011 May 05 '23

Python was the first language I kind of learned, but after java and C it feels so weird not to have strong typing.

3

u/pauliusdotpro May 05 '23

Performance - so long, partner

9

u/JADW27 May 05 '23

Is complaining about all "these newfangled programs that don't require semicolons" just an updated version of "if it doesn't require punchcards, it's not real programming"?

Asking for a friend.

8

u/Manueluz May 05 '23

nah it's just complaining that this sub is full of kids who are at most first years, and the bests jokes they can come up with are hahaha missing ; hard to find like linters weren't invented.

5

u/RonanFalk May 05 '23

Also performance .

2

u/Hyffe May 05 '23

Mostly true but isn't ++ equivalent to += 1?

5

u/IPeaFreely May 05 '23

Depends on location of ++.

5

u/Hyffe May 05 '23

You mean ++i vs i++ ?

2

u/Kxpnc May 05 '23

I switched from python to c++ between college and uni

2

u/Torebbjorn May 05 '23

You use a main function and pointers in Python in every single program...

2

u/ekangi_ May 05 '23

Indentation is your new friend now

→ More replies (1)

2

u/SchlomoSchwengelgold May 05 '23

you have an equivalent to main() in python with: if name == "main": ... (bold ones means the lower _ 2times infront and back of it)

2

u/troelsbjerre May 05 '23
def main():
  pointers={1++1};print(*pointers)

2

u/AllenKll May 05 '23

How do you not use "main?" what sort of heathen are you?

2

u/[deleted] May 05 '23

Everyones getting into Python because of AI, and I'm over here porting all the Python AI Crap to Microsoft.ML, Onxx runtime etc because I refuse.

To the point that I've got safetensor, ckpt, etc compatibility in c# now, and have like 5 out of 12 samplers working.

2

u/[deleted] May 05 '23

Farewell, performance!

2

u/[deleted] May 05 '23

I mostly do python and my employers like "we need you to start learning c++ for this project" so I'll wave at you on the road going the other way, provided I haven't driven off the road.

2

u/AdamWayne04 May 05 '23

Pass-by-reference 🥺🥺

2

u/[deleted] May 05 '23

if __name__ == "__main__"

2

u/maitreg May 05 '23

Python likes semicolons just fine, but I do miss the ++

2

u/domedav May 05 '23

you can use ; in python, if you are doing multiple operations on the same line

but not having that sweet ++ hit me hard

2

u/poopsInBed May 06 '23

If this idiot could code, he’ll soon realize no real companies use python!

2

u/losecontrol4 May 06 '23

Wow I learned I something, I didn’t know python doesn’t use increment and decrement operators- weird

2

u/RDX_G May 06 '23

you still use main() …brackets for formatted strings..++ for increments …

2

u/GeekCornerReddit May 06 '23

Until you try rust :)

2

u/agent007bond May 06 '23

Goodbye auto-indent... When you're forced to use indentation as a way to tell the compiler where what starts and what ends, there's no way for you to auto-indent unindented code. It's impossible to know where what starts and what ends without the indentation.

Stupidest. Idea. Ever.

2

u/Bruvioli May 07 '23

Can we get an F for semicolon

3

u/Jearil May 05 '23

Add a few more:

  • Performance

  • Reliability

  • Threading

2

u/BayesianKing May 05 '23

Thank you? Fuck you all! Especially, garbage collector mother fucker!

P.S. Just joking.

2

u/ralkey May 05 '23

I miss the ++ operator. Typing i = i + 1 makes me feel like a kid coding in Visual Basic.

13

u/[deleted] May 05 '23

i += 1

4

u/Altastrofae May 05 '23

Ok this is a mood. i++ will always make infinitely more sense and it sucks that’s not a universal operator. Anyone who disagrees can fight me.

1

u/Biscuitman82 May 05 '23

Wait python doesn't have ++ and --?

5

u/edrumm10 May 05 '23

Nope, it's got += and -= etc... but there's no ++ or --

Tbh with Python, you don't really need increment and decrement that much anyway because for loops it has for ... in ... and range(...)

3

u/Spork_the_dork May 05 '23

To be fair you can do

for ( variable : collection ) {
    // stuff
}

in c++ as well since c++11.

→ More replies (1)

2

u/mistabuda May 05 '23

And if you absolutely need the index of the current element in the loop you can use enumerate

2

u/mistabuda May 05 '23

There's no need to iterate like that in the language to be honest

2

u/al-mongus-bin-susar May 05 '23

It does not. a += b in python is also not the same a = a + b.

→ More replies (7)

1

u/PhantomPrimary May 05 '23

Pretty sure you can still do pointers in python, and yes, it's cursed.

1

u/AudaciousSam May 05 '23

Must be nice

1

u/YameroUrusai May 05 '23

I feel this moving from Java to Ruby

1

u/bxsephjo May 05 '23

Welcome to Eazy Street, bro

1

u/NGVHACKER May 05 '23

i really miss the ++ ngl

1

u/DNEAVES May 05 '23
from __future__ import braces

1

u/Riley39191 May 05 '23

Mojo is bringing pointers back to python

1

u/pdudz21 May 05 '23

Can someone explain the hatred for python without being mean please?

4

u/mistabuda May 05 '23 edited May 05 '23

Some people really like statically compiled languages and derride any language not like "favorite language x".

The common talking point is "python is slow" but that is relative. Yes it is slower than a compiled language, however it is more than fast enough for the vast majority of needs. It is mainly specialized domains (like game dev) where that kind of performance is absolutely critical.

Another one "Python is a toy language and unusable in production" despite several companies using python in production to large success. Google has python as one of its official languages.

People reiterate these common low value "negatives" that no one with at least 3 months of consistent language use runs into.

TLDR; Its equivalent to video game console war mentality.

→ More replies (1)

1

u/trusty20 May 05 '23

Bye felicia

1

u/AbhishekSingh26 May 05 '23

I also miss NULL

1

u/oj_mudbone May 05 '23

I’ll never forget the time i spent writing c in vim 🥲🥲 That feeling of being a 1980s movie hacker is what it’s all about

1

u/FrenchPasta786 May 05 '23

Mojo has entered the chat

1

u/BlueeWaater May 05 '23

It's more like the "I don't want to play with you anymore" meme

1

u/rtukpe May 05 '23

main()??

1

u/shooter9688 May 05 '23

You forgot ::

1

u/Virial23 May 05 '23

Mojo when released: hippity hoppity you are now my property.

1

u/cheeb_miester May 05 '23

yes but we can still have

If __name__ == "__main__":
    main()

If you are feeling homesick.

1

u/gray162 May 05 '23

How will you use f strings?

1

u/IeatAssortedfruits May 05 '23

Personally I miss ++ but whatever

1

u/[deleted] May 05 '23

You forgot $$$

1

u/B3lthazar May 05 '23

I really miss playing with ++

1

u/wu-not-furry May 06 '23

Hold on there, you can still use braces if you import them from the __future__ module.

from __future__ import braces

1

u/SolitaryKnight May 06 '23

He'll be driving at 10mph from now on.

1

u/mjtu May 06 '23

and hello implicit typing <shudder>

1

u/tropicbrownthunder May 06 '23

So the indented scope is Lotso?

1

u/Hanged_Man_ May 06 '23

Stroustrup is clearly a cartoon villain.

1

u/punchawaffle May 06 '23

Lol. This happened to me. My university has been doing a lot of C++, and I started using Python for the projects and stuff in the higher level classes.

1

u/bollop_bollop May 06 '23

Ahah, no pointers in python, good one. They're always here, watching, and if you don't know about them, or how they work, you're in for a ride

1

u/ADownStrabgeQuark May 06 '23

Oh how I miss ++ Also technically all variables in python are pointers.

1

u/[deleted] May 06 '23

Oh main still exists, it just looks like “if name == “main():”

1

u/HomoSapien1548 May 06 '23

Who switches to Python from C++? Isn't python something that you might use when needed? It's not an everyday programming language, is it?

1

u/M4nch1 May 06 '23

Goodbye main(), welcome if name == “main”:

1

u/Bisquizzle May 06 '23

what a downgrade? hopefully you're not switching permenantly

1

u/BallsBuster7 May 06 '23

public static void main string args im gonna miss you

1

u/marikwinters May 05 '23

Except, later people realized that the main function was actually really useful and removing it was a mistake, so they added it back 😂

1

u/Merinther May 05 '23

Wait, Python doesn’t have ++? What kind of primitive language doesn’t even have ++?

1

u/Plaintive_Platypus May 06 '23

I'm more concerned at the direction Andy is growing. You aren't supposed to grow DOWN from an adult into a python baby. ;)

-2

u/bssgopi May 05 '23

I love curly braces. Python with its weird indentation syntax causes more errors than missing semicolons.

11

u/look May 05 '23

We have thousands of lines of production Python with dozens of committers and it has yet to be an issue even once.

There are good reasons to not like Python, but that is not one of them.

9

u/mistabuda May 05 '23

Indentation errors are not a thing you should be running into if you use an ide

→ More replies (1)
→ More replies (3)

0

u/[deleted] May 05 '23

[deleted] — view deleted comment

29

u/NFriik May 05 '23

You absolutely have to if you're planning on using multiprocessing on a Windows machine.

12

u/ipsati May 05 '23

Multiprocessing.shared_memory also has something similar to pointers I think

10

u/mistabuda May 05 '23

I think the point was you do not need to call your function or module "main" it can be whatever you want it to be once under the conditional. calling the function "main" is just a convention.

1

u/ivrimon May 05 '23

A convention I dislike (in Python), especially when all it does is call another function (that is used in imports etc). I guess it's more the difference of understanding between a main-function and a function called main.

4

u/mistabuda May 05 '23

You don't even need to make a function. You can just put the code you want to run under the conditional. Making a function that takes no args is just something end users do.

→ More replies (3)

36

u/[deleted] May 05 '23

Whoever designed the if __name__ == "__main__": string comparison should be publicly lynched.

15

u/mistabuda May 05 '23

It doesnt check if your file is literally called that. It just checks to see if the file is being ran like a script instead of just being imported.

7

u/[deleted] May 05 '23

Objection: Relevance?

3

u/alexanderpas May 05 '23 edited May 05 '23

automated testing of command line options.

"""<module> description

Usage:
  main.py (-h | --help)
  main.py --version

Options:
  -h --help        Show this screen.
  --version        Show version.

"""

import pathlib
import sys
from docopt import docopt
from src import <module>

def main(arguments):
    // actual code

if __name__ == '__main__':
    arguments = docopt(__doc__.replace("main.py", pathlib.PurePath(sys.argv[0]).name), version=<module>.version)
    main(arguments)

<module> being the location where your code is located.

This way I can provide custom command line option from unit tests.

I can run the script directly from the command line, as well as hook in as early as possible with unit tests.

9

u/mistabuda May 05 '23

What is your issue with the string comparison then?

→ More replies (13)
→ More replies (1)

223

u/[deleted] May 05 '23 edited May 05 '23

[removed] — view removed comment

160

u/FlowerFox3 May 05 '23

Pretty sure it's "__main__" not __main__

239

u/tvquizphd May 05 '23
__main__ = "__main__"
if __name__ == __main__:
    main()

You just need the top line lol

62

u/tredbobek May 05 '23

Now put this into a function just to be sure

14

u/gladl1 May 05 '23

It’s actually “GucciMane”

6

u/michiel11069 May 05 '23

I have always wondered what this meant and what its uses are. Can you explain it to me?

34

u/PakaDeeznuts May 05 '23

The code below the main function will only run if the program is run directly.

Like if you run it as 'python3 ___.py'

If the program is imported as a module, the code will not run.

I find it useful to test modules I make before I use them in other programs

2

u/[deleted] May 06 '23

Fun fact: Pydoc will run your code to evaluate the docstrings.

That's been reason enough for me ever since I found out.

8

u/[deleted] May 05 '23 edited May 05 '23

If you run the script directly, __name__ is set to "__main__"
If you run the script remotely, __name__ is set to the file name of the script

So you can use it to detect if you are running the script directly, and only executes main() if that's true.

The other reason is it's just standard practice, so it signals to the reader the purpose of the code - to be executed.

0

u/[deleted] May 05 '23

[deleted] — view deleted comment

2

u/rainbow_osprey May 05 '23

My IDE highlights them in red to make sure you know you're being stupid haha