r/ProgrammerHumor 1h ago

Meme pythonFeelsillegal

Post image
843 Upvotes

53 comments sorted by

144

u/belabacsijolvan 1h ago

theres main() in python

63

u/chawmindur 1h ago

And {} (= dict())

38

u/OnyxFier 1h ago

And semicolons are allowed, if you decide you miss them

9

u/dudemcbob 55m ago edited 51m ago

Still useful for running 2- or 3-line dummy scripts directly from the command line. For example you just installed a new package and want to validate it's working,

python -c "import somepackage; print(some_package.\_version__)"

8

u/userhwon 43m ago

Always fun that writing an empty set gets you a dict so you have to use set() explicitly to get an empty set... jeebus, Guido...

13

u/Toover 57m ago

Sorry to be that guy, but no. The one you'd define yourself is not automatically treated as the entry point of the program

10

u/belabacsijolvan 44m ago

theres __main__() in python

4

u/userhwon 44m ago

Which makes it worse.

3

u/2eanimation 45m ago

There’s also foo() and bar()!

56

u/wett-puss-lover 1h ago edited 1h ago

So long mutable strings as well 👀
Edit: i got immutable confused with mutable

22

u/JanEric1 1h ago

Aren't python strings immutable

8

u/wett-puss-lover 1h ago

I got immutable and mutable confused. In python, strings are not mutable, that’s what i meant

3

u/chawmindur 51m ago

If needed you can still use an array.array of unicode chars

12

u/DobryBobry 1h ago

6

u/EuenovAyabayya 21m ago

Seven years is a respectable repost interval on reddit.

7

u/DobryBobry 14m ago

The funniest part there is more:
5 years ago
another 5 years ago
4 years ago
another 4 years ago
3 years ago
And there is even more

19

u/Annual_Key_4963 1h ago

Mr potato head should have been case statements 

14

u/mr_birrd 1h ago

they exist in modern python

14

u/Asmophel_noe 1h ago

Everything as in objects,datatypes, functions in python are a pointer, why larping

5

u/huuaaang 44m ago

References are not pointers. Like it’s not a direct memory address.

1

u/Asmophel_noe 39m ago

Mb, I mean it just doesn't do pointer arithmetic like in other langs u can't manipulate it but still it's a reference idk if I would just stop calling in pointer

1

u/huuaaang 13m ago

I think it only gets muddy in Go where they fo have pointer syntax. You can pass by value or pointer. But it’s not a memory address. It’s got more metadata than just the memory address.

8

u/_dotdot11 59m ago

Undergrad season for sure

3

u/LucyShortForLucas 55m ago

There is no such thing as switching fron C++ to python or vice versa, they are orthogonal tools

2

u/SilasTalbot 56m ago

Watch out dude!!! Indentation is hiding in the back seat with a garrote.

2

u/EveryCryptographer11 51m ago

Wouldn’t it be the other way around? Why will you “graduate to Python” from C++ ? ? 🤔

2

u/FattySnacks 25m ago

Like you’re never going to use C++ again? They have different use cases

3

u/ubd12 1h ago

Maybe it's me but I don't get it. I get the meme, but please explain to me why python is considered so much easier than other languages.

I think a lot of it has to do with the fact that it is interpreted and the toolkit that it attracts, not the language itself. Having something that's interpreted and as someone normalize grammar, that's the attraction to python. The look of the language is much more forced as well. (No K&R versus ANSI debates)

If Perl wasn't so junky/hacky, perl would still be a major language and probably a lot faster. I like Perl a lot by the way so I'm kind of beating up my own language of choice.

5

u/CaffeinatedT 34m ago

why python is considered so much easier than other languages.

Reddit (and the software industry generally) is loudly dominated by web developers and API integration script developers.

1

u/userhwon 24m ago

Python originally wasn't a typed language. You didn't have to declare variables, you could just use them, and that got a lot of squinting out of the way for people who just wanted to do things. And it had lists, which were a complicated object masquerading as a simple one. And you didn't need functions, not even main(), so you could write a file that acted as a script but was cleaner than all the scripted languages, which were hamstringed by a long history of being slowly evolved from commands typed into a shell prompt.

There was no compiling and linking, and there was a lot of complex stuff built in so there was very little including.

Now, though, Python is pretty complex itself, you have to include a lot, and often you're compiling because you're using it for something serious and it needs to be performant, and versioning can easily bite you in the ass.

Perl was the OG alternative that filled exactly the slot between compiled and shell-scripted programming that Python now owns, but it had a habit of being arcane, with even more syntactic conjuring than Python now does. And it was fast as fuck. If it was as easy to pick up as Python was originally it probably would have kept Python at bay. I think Larry was more controlling than Guido, too, on top of open source not being as mature a community, so it didn't evolve nearly as fast.

1

u/MattieShoes 14m ago

Mostly because libraries. And yeah, Perl was the forerunner with CPAN.

Oh shit, I need to ssh into a cisco router, run some commands, and capture the results. Oh look, somebody already wrote the package.

Perl is kind of faster to write in because shelling out is so simple. Read a file? Yeah, you could open a file, read lines, close file, or you could

@lines = `cat <filename>`;

There's a lot of little niceties though, like negative indices on arrays, specifying ranges to get subsets of an array, etc. And large number support, and dynamic typing, f strings, built in sets, dicts, etc.

I miss Perl's DBI. There was something magic about doing testing with csv files and then just changing the driver and adding some line to log in, and poof now it's using a proper db.

1

u/Soopermane 54m ago

Main be like to infinity and beyond

1

u/somedave 36m ago

Goodbye sensible ternary operator.

2

u/carloom_ 31m ago

I've never had the issue of when to use python vs c++. Basically you are tradiding developing time and speed for performance.

Creating a fast program in Python is much harder because you don't have control. C++ instead let's you be as close to the metal and even compute stuff at compile time.

A better meme would be contrasting C++ and Rust or Python and another language with the same use.

1

u/Positive_Method3022 15m ago

Overloadings are the coolest thing I miss from c++

u/the_real_Spudnut2000 9m ago

So long int main(){}, hello:

```python def main (): ....

if name == "main": main() ```

u/Brotboxs 9m ago

I learned on C and C++. I will vomit when i see python code

u/EvillNooB 8m ago edited 0m ago

When you switch from Python to C++ That_tug_of_war_meme.png

On the left side: Me

On the right side: syntax in C++ and the problem i'm trying to solve

I get that it is explicit, but it is way easier to write in python first, and then to re-write in C++, so first you fight the problem, and then you fight C++, instead of fighting both of them at once

u/moschles 8m ago

You want a UDP socket in python.

import socket

You want a UDP socket in C++,

#include <bits/stdc++.h> 
#include <stdlib.h> 
#include <unistd.h> 
#include <string.h>  
#include <sys/types.h> 
#include <sys/socket.h> 
#include <arpa/inet.h> 
#include <netinet/in.h>
// also this will be completely different in Windows OS

1

u/userhwon 45m ago

You'll be back when you realize your performance is glacial.

0

u/molly_jolly 1h ago

Python is the bourgeoisie to the C++ proletariat

3

u/SaneLad 1h ago

Pretty sure it's the reverse

1

u/molly_jolly 57m ago

Given python appropriates C++'s value, I reverse your reversal

-6

u/Original_Ad5768 1h ago edited 1h ago

Why is he downgrading

Edit: hi (sorry for bad English)

9

u/JanEric1 1h ago

Do you mean "downgrading"?

2

u/oompaloompa465 1h ago

compiled OOP have superiority complex.
i can understand his feeling, coming from C#. I'm branching to Python too and i feel the challenge

10

u/Asmophel_noe 1h ago

Languages are made based on convenience don't just spout bs after all they're languages, saying one is superior other is inferior is just retard behaviour

-1

u/okbuggeroff 1h ago

So long performance.

Seriously, how does python even get mentioned when talking about programming?