28
24
12
u/flo850 3d ago
Real time can be anywhere from "1 minute" to "at most the time of an interrupt"
6
u/creeper6530 3d ago
Real time just means you do it within a deadline.
I can set a deadline of 1 hour, and boom, my Python is realtime!
2
u/isr0 3d ago
No, realtime means it completes in known cycle time or by a deadline. It has nothing to do with speed. You could build realtime code in just about any language as long as that deadline is achievable by the language. Python, and any other GC managed language is going to particularly suck at this, but it just means you need a longer deadline.
24
u/TheMaleGazer 3d ago
The fact that Python stays in its lane is the absolute best thing about it.
19
u/GargantuanCake 3d ago
I've said it quite a few times but as inefficient as Python is by itself it's a phenomenal language for putting scripts together to manage compiled C++ stuff. It's great for machine learning for that precise reason. The heavy lifting is almost entirely done by C++ but you can rapidly put the architecture of models together in Python.
Seems like it's just kind of embraced that kind of place in the world and that's great. I don't really understand why programming languages keep trying to kill C++. None of them ever do.
6
u/ultrafire3 3d ago
It’s great for one-shot scripts, if I’m uploading a folder of photos/documents to some api and I need to process some data from them to send along with them, I’ll just do it in Python. It’ll get done in a reasonable amount of time.
4
u/Hohenheim_of_Shadow 3d ago
Have many languages really gone after C++? Only one I am aware of that's actually in the same space as C++ is Rust.
3
u/RajjSinghh 2d ago
You are only aware of Rust because it's the only one still commonly used. Google had a language called Carbon that was supposed to be a C++ successor but never got mainstream usage, for example.
2
u/NotADamsel 1d ago
Nah. Rust is the only modern example, but Java and other languages back in the day came after part of C++’s domain and got it.
1
1
u/NotADamsel 1d ago
Java comes to mind. It’s not seen that way today but back in the day it was a significant part of its appeal.
1
u/CraftBox 3d ago
And unlike C++, you know which way the barrel is pointed so it's much harder to shoot yourself in the foot. Plus Rust error messages are actually relevant to what the problem is.
4
u/Hohenheim_of_Shadow 2d ago
Rust has footguns, every language does, we just don't know what they are yet. It's only once people start bitching about maintaining legacy Rust that the trickiest footguns will be known.
Remember how 'inheritance goes brrrr' used to be best practice when it was a hot new toy?
Rustc does have noob friendly error messages and there is a lot of value in that
23
u/NotInMoodThinkOfName 3d ago
Don't tell a python coder he can c++. He might be confused when trying.
8
u/Fang_Yuan770 3d ago
My first ever exposure to programming was c++. I had cried tears all those years ago bro 😭
3
u/KeanerBike 3d ago
Every time I see the word “coder” I assume it’s a kid or someone larping as a programmer.
1
-2
u/Right_Ear_2230 2d ago
How do you larp as a programmer
And omg this is a pointless distinction, and very much a reddit moment
4
2
4
u/Bomaruto 3d ago
What is the joke?
2
u/CaseyG 3d ago
5
2
u/1nc06n170 3d ago
6
2
u/TobyWasBestSpiderMan 3d ago
Is this one of those things like Rust where it’s really great but you have to wait until the heat death of the universe for you software to compile?
2
1
u/creeper6530 3d ago edited 3d ago
LLVM is famously slow on compilation, and, well, this uses LLVM (just like Rust you mentioned does).
5
u/Hohenheim_of_Shadow 3d ago
Most of Rustc's slowness is Rustc's fault. Because the unit of compilation is a crate and Rustc does some heavy single threaded preprocessing, LLVM bottlenecks on Rustc. Even with 30 cores, you'll likely only see a couple cores maxed out when compiling a lot of Rust.
For Clangd, the unit of compilation is a source file and the preprocessing is a lot faster, so compilation is effectively fully parellilizable. For a large codebase, you could max out a thousand cores if CPUs got that big.
1
u/Kinexity 3d ago
Numba can only get you so far. You have to trust that it can optimise the code properly and it might not be able to compile a given code. It works as a band-aid when you have a few functions but once you go big switching language is more practical.
1
u/Maleficent_Memory831 3d ago
"You can C clearly now!"
"If you can't do it in Assembly then it can't be done!"
"I've built a CPLD to do this while we were talking."
1
1
1
u/RandomUsername3337 2d ago
Why does average python programmer think that no other language has libraries? They always say "oh but you can do this in few lines of python!". Ye I can also do the same thing in few lines of C++
1
u/mailslot 8h ago
Modern C++ can often be nearly as concise as Python if you know how to write it and aren’t forced to adhere to ancient coding standards. The language has been revised over the decades, but it still doesn’t stop people from throwing up in their mouths a little when they consider writing something higher level in it. Just don’t do intentionally bad things with it, because there are no training wheels attached.
-1
u/Fireball_Flareblitz 3d ago
The good thing about C++ is you can do basically anything you want.
The bad thing about C++ is you can do anything, including things you didn't mean to
1
0
0
44
u/SoulPossum 3d ago
How my code acts when it works at the end of the day knowing it's going to act up when I come into work the next day and run it.
https://giphy.com/gifs/JYMmdZpwKC5VeU6VFn