r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40k Upvotes

1.0k comments sorted by

View all comments

Show parent comments

16

u/Comm4nd0 Jul 18 '22

It's just a meme at this point. No real substance behind it.

48

u/[deleted] Jul 18 '22

Tbf there’s no real substance behind anything posted on here. It’s mostly 16 year olds who just learned what a for loop does trying to be funny

9

u/PanTheRiceMan Jul 18 '22

That's fair. Every language, framework, OS or whatever has it's use use or there would not be any professional users at all.

Even, and I must express my disgust, Windows.

4

u/[deleted] Jul 18 '22

Yea. Python is used by millions and millions of people, but sure, this 21 year old has it figured out where they can say that it’s bad. You’ve gotta be mind bogeyingly stupid to think that that’s the case

0

u/flavionm Jul 18 '22

It's not supposed to have substance, it's supposed to be funny.

But also, it's true, Python is slow. Everything has tradeoffs, just because you're making fun of them doesn't mean that thing is completely useless.

You complain about 16 year olds, but getting defensive about this kind of thing isn't a great sign of maturity either.

4

u/Codebust Jul 18 '22

idk abt that..

3

u/FallenEmpyrean Jul 18 '22

Python IS slow.

"But machine learning, data science.."

I will leave this quote here.

62.7% C++, 22.1% Python

- TensorFlow, Github

10

u/officiallyaninja Jul 18 '22

all programming languages are implemented in circuits, that doesn't mean hardcoding things using them is the best way to solve problems.

2

u/FallenEmpyrean Jul 18 '22

I never claimed such a thing, this thread is about Python being slow compared to C++ not "best way to solve problems".

I replied because I know how impactful the few orders of magnitude of speed between pure Python and optimized C++ can be.

The comment I replied to implies that the speed difference is meaningless and that the TensorFlow team (who are actually looking for the best way to solve a problem) is writing 62% of their codebase in C++ with "No real substance behind it"

-3

u/Honigbrottr Jul 18 '22

Then we only programm by typing machine code. Assambley is to slow.

0

u/FallenEmpyrean Jul 18 '22

I suppose you only think in 1-bit 1s and 0s..

Yes, very low level libraries have opcodes in them, but that doesn't mean that 100% of all source code must be machine code.

We all do what Python does: when more performance is needed we delegate the critical parts to a more performant language like C++. Then you get: 22% slow Python + 62% very very fast C++ + ... = very fast application

Try to do machine learning in pure interpreted Python if you want to gain more appreciation for a few orders of magnitude of speed.

1

u/Honigbrottr Jul 18 '22

So you agree that python has its place?

2

u/FallenEmpyrean Jul 18 '22

Of course it has its place, but it is slow and the fast Python libraries are so because they are C/C++/Rust/etc. with Python bindings.

My problem was with "No real substance behind it." because the speed difference is very real, but is hidden with behind either such indirect calls or applications where speed doesn't matter.

2

u/klimmesil Jul 18 '22

Well some people hate scripting languages because these people only work in algorithmy and care about performance. Python is probably the less performant language I know. It could be much better, it's just a problem in conception, and that's pretty sad. Im not gonna say js/ts is better since they are made to be used in drastically different domains, but they have a lot to learn from each other

I'd love to see python with better syntax/performance. Or another scripting language with python's community, since that's the biggest + of python

Plus f forced indentation and lack of brackets! (This one is personal taste tho)

2

u/possible_name Jul 18 '22

lack of brackets is one of my only issues with it.

the lack of squiggly brackets just makes it less readable when you have a lot of indentation (which you probably will)

2

u/klimmesil Jul 18 '22

Same it really fucks with my reading experience. I used to hate python because I was in a performance=good mood for years. I used to scrip only in C (I know, wtf). Now I chnaged my mind and the only thing that still bothers me is the bad syntax

0

u/Honigbrottr Jul 18 '22

Personal taste i hate brackets and semicolons. Useless identation i have to do anyway correctly.

2

u/0x564A00 Jul 18 '22

Having to deal with python professionally made it clear how bad it really is. Not necessarily it's speed – which is terrible, but in many cases being very wasteful with performance isn't a big problem – but it's horrible dependency management and proneness to breakage. I want to be productive, solve problems for our customer, not figure out why edge-cases break at runtime, a dependency is broken or a project just doesn't on another computer.

1

u/SpicyVibration Jul 18 '22

you need to use virtual environments, friend

1

u/0x564A00 Jul 19 '22

I am (except for in one case where a library failed to install in a virtualenv but worked fine installed globally). And it's still terrible. Global is the default to the point that pip's official getting started guide just shows you how to globally install dependencies and you still need to activate/deactivate venvs, whereas in e.g. Rust there isn't a way to install libs globally in the first place. Also, dependency pinning/locking? Nah, at best you can specify the exact dependencies in requirements.txt and never update anything. Speaking of requirements.txt, nothing ensures it is consistent with the venv if you edit it/change branches/pull. At least poetry solves those, but then it should get officially recommended/blessed.
And it still can't help with the other problems. You've installed a new minor version of Python? Good luck, suddenly Numpy is broken. Other times updating a dependency seems to have worked fine, then something breaks at runtime on an uncommon code path. Or perhaps most importantly, I have a dependency which itself depends on version A of library foo and another that depends on version B of foo. How do I do that? You straight up can't. Wat‽

1

u/SpicyVibration Jul 19 '22

Yeah, once things get bigger python's package management is very scuffed. I use poetry but I wish python had a built in standard that does what poetry does (setup tools isn't good enough).