POLL: What is better? Python or C++

YEAH! Python best :wink:

Well, i understand why people love python … but try to make a server managing millions of messages per second … it is few lines of code in Erlang, much more in C, a bloated app in go, impossible in python.

1 Like

This is python vs cpp, and it is very rare the people make giant apps in the first place. If I had another choice I would always go with Nim, it is almost as easy as python and almost as fast a C, a compromise.

1 Like

What do you define as giant app? Now I am curious :face_with_monocle:
Only played with NIM. One day I will play more, maybe this week end since I have a 12 hours flight to fill.

1 Like

One that has million messages/requests or more in an hour. That is big scale as far as I know in my limited knowledge.

1 Like

Not really. Games are much bigger :slight_smile:
Anyhow, I like both python and cpp and there is not better per se, but I understand why people love python (hell my son does), but python works because c is used for its interpreter, the OS, etc etc. :smiley:

4 Likes

@whileTRUEpass print vs std::cout… I dunno man, I think C++ is a bit hard…

1 Like

If this is hard … ouch,

1 Like

At its core it’s a REALLY easy language. It was my first actually lol. Dealing with memory and leaks and whatnot is what turns people off of it.

2 Likes

Just put using namespace std; at the top of your file and you don’t have to use the std:: part.

Also obfuscation can make print statments an Eldritch abomination :slight_smile:

1 Like

That’s a large server thing. An app like that could be in one file if you shrink it well enough. 4Chan gets that kind of service and their source is what I estimate to be maybe one 234 line file. I’m not moot tho so I wouldn’t know, just judging by the bare bones HTML of the place.

It is labeled as super hard all the time. I think it’s not :slight_smile:

1 Like

Usually labelled super hard by people that either know very little of it or don’t know what assembly is.

2 Likes

Totally agree. And it is the only choice if you want to go into embedded programming and build cool stuff gadgets.

They both have their uses but at least C++ can use threads to actually run things concurrently.
Python has a global interpreter lock so only one py function can ever be running at once. Excluding native calls that don’t modify the interpreter, which is the only time threads can run at the same time.
Hence when python devs need truly concurrent code, they resort to making child processes and sending pickled objects over IPC.
Then again it’s also a hassle to fight header files and have to type the same definitions multiple times in different files.

1 Like

@anon45021817 OK, well even if you do write using namespace std; at the top (which I usaually do anyway) for beginners the << thing is almost a dumpster fire. Also, here are what the creators of the languages said:

“C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off” – Bjarne Stroustrup

“Python is an experiment in how much freedom programmers need. Too much freedom and nobody can read another’s code; too little and expressiveness is endangered.” – Guido van Rossum

1 Like

Those lines are also a reflection of the two different personalities. If you would have met them in person (than you would be as old as them and me), you would realise the language and the comments are truly an expression of the author.

I also would encourage people to split C from C++. Love C, C++ … too much bloating stuff

2 Likes

I regularly get so angry that they keep adding tons of useless STL features to C++ that it took until C++20 before we even got a mention of modules.
And still we don’t have a simple string split function that you don’t have to implement yourself or with some obscurely named function/STL method.

2 Likes

To each their own I suppose, but I was making fully functional C++ programs at 9 years old. IMO C is harder than C++. The << becomes muscle memory after a while. To many people Python is easy, but is comparable to writing an essay rather than coding. Expressions can look like sentences, seen here: with x as y

1 Like

I prefer C, but i guess since I learnt ASM at 8, C was like a revelation of simplicity.
I never loved C++ and ended upo using it as C+a bit of classes (and i am not even the only one)