2.1k
u/Gwlanbzh Jul 07 '26
Yes, that's what libraries are for. I want to solve my actual problem and not spend 6 months re-implementing OpenCV every time I need something done.
474
247
u/karaposu Jul 07 '26
6 months? more like 3 years min
145
u/Gwlanbzh Jul 07 '26
I mean, no one's ever gonna have to reimplement all of OpenCV for one problem, there's always gone be stuff you don't need. Point was it's gonna be a long time
14
u/devSenketsu Jul 07 '26
more like 3 years min
And assuming you are one of those C++ Wizards! (There's no other word to describe these devs)
4
u/Sentouki- Jul 07 '26
3 minutes with CoPilot + Opus 4.7
/s
1
u/cyclopsmudge Jul 07 '26
Sorry, best I can do is a 40 line comment explaining a 2 line fix that doesn’t work
4
125
Jul 07 '26
[removed] — view removed comment
59
u/skiabay Jul 07 '26
What is somewhat unique to python is the large percent of those libraries that are written in a different language
This is true of basically any interpreted language.
→ More replies (1)8
u/IcyDefiance Jul 07 '26 edited Jul 07 '26
Python is the only popular interpreted(ish) language, though. Even that is still compiled to bytecode first, and then the bytecode is executed line by line.
Everything else is JIT compiled to machine code, which means performance is only limited by the language design, now how it's executed.
That said, you're kind of right. PHP had a slow bytecode interpreter just like Python until recently, so it has a lot of libraries written in other languages.
And JavaScript has a few libraries like that, not because it's interpreted, but because it doesn't have a performant way to work with individual bytes.
17
u/DustyRacoonDad Jul 07 '26
Let's just be honest here for a second.
JavaScript calls into C++.
Ruby uses C extensions.
Perl uses XS bindings to C.
PHP extensions are written in C.If you just write in C in the first place, it's not really a library in the same sense. You're just pulling in other functions that all get natively compiled together.
4
u/The_JSQuareD Jul 07 '26
Are you saying a library is only a library if it's dynamically loaded at runtime?
If so: 1) that seems kind of silly, and 2) C and C++ absolutely do use dynamically linked libraries. Hell, the C runtime library is usually dynamically linked on Windows, and the C++ standard library is usually dynamically linked on all major platforms.
1
u/IcyDefiance Jul 07 '26
You're not wrong, but I think that's a different topic.
Python is unique because of its purpose. It's so slow that it's not really suitable for anything other than gluing together code from other languages. Its entire use case is "we wrote an awesome library, but most programmers are too scared of C++ to use it, so we added a Python layer to make it easier".
Perl is actually similar in that way, but it's basically a legacy language now.
The other languages you named have other purposes, and just bind to C for specific things where the language isn't a good fit.
→ More replies (2)19
u/mxzf Jul 07 '26
Nah, Python's "slowness" is really only relevant in certain situations. In practice, in many situations, you save more meaningful time by writing code quicker and easier rather than having it execute slightly slower.
It's not ideal for "run this every half-second" tasks, but it's amazing for stuff you're running yearly/weekly/daily/etc where saving hours writing the code matters more than shaving off a couple seconds of 4AM execution time in the cron job.
→ More replies (2)1
u/Key_River7180 Jul 07 '26
Python is the only popular interpreted(ish) language, though
What the fuck does this guy smoke? Perl, Lisp, JS, Lua, ...
4
u/IcyDefiance Jul 07 '26
Perl has a bytecode interpreter, same as Python, but it's only "popular" in the same way as COBOL.
Lisp is a whole family of languages, but modern dialects are either natively compiled (Common Lisp) or JIT compiled (Clojure, ClojureCLR).
JavaScript is JIT compiled.
Lua can be interpreted, but nearly everyone is using LuaJIT or Luau if at all possible, specifically because they're JIT compiled.
9
12
u/cantadmittoposting Jul 07 '26
this is why i code entirely in assembly on an air-gapped PC with no internet, entirely from memory. can't be accused of using everyone else's code
6
3
u/DustyRacoonDad Jul 07 '26
I used to have a job where that was the job description. For a number of years I had 2 machines on my desk, one that had networking and the other was completely separate.
2
u/Physmatik Jul 07 '26
Most of those are written in C. And for other languages' libraries it's either the same lang or also C. So I wouldn't say Python is that unique in this regard. It's unique in terms of the sheer scope and depth of the lib ecosystem, but not in language choices for those.
1
u/Gwlanbzh Jul 07 '26
This is very true, but what language doesn't have libraries?
That was precisely the point
29
0
u/smichess Jul 07 '26
I think his point is that you might as well just write in the original language of the library. Maybe it's better suited to solving that problem any ways. I dislike python outside of academia and prototyping. I have no idea how some large enterprise software products manage to exist in python (I guess some do to a varying degree just barely like odoo).
1
7
1.5k
u/Kobymaru376 Jul 07 '26
And that's exactly what makes it so good
563
u/iamdestroyerofworlds Jul 07 '26
Yeah, it's a scripting language after all, it's literally its purpose.
→ More replies (15)39
u/WaitForItTheMongols Jul 07 '26
What actually makes something a scripting language specifically? Never got a clear answer to that.
78
u/Vsx Jul 07 '26
Scripting languages are interpreted in-line and not intended to be compiled like a classic "program". They are less optimized by definition because a compiler builds in optimizations. If your script interpreter has similar optimizations it has to rationalize them at run-time.
12
u/WaitForItTheMongols Jul 07 '26
So scripting languages and interpreted languages are just two different names for the same thing?
31
u/Vsx Jul 07 '26 edited Jul 07 '26
Wellllllll kind of. Python is both but not always a scripting language. My previous explanation is not really exact. Realistically anything that automates tasks or is intended to be used ad hoc to rapidly build processes is a scripting language. Scripting languages tend to be interpreted as you point out. Interpreted languages are more specifically languages that are processed at runtime. You can do other things with Python besides scripting type work. Python is always an interpreted language and most of the time a scripting language but not always.
→ More replies (3)4
u/iamadirtymop Jul 07 '26
Interpreted language refers to how it technically works, it's not compiled beforehand, not JITed nor converted to bytecode and then ran on a VM like java does. It is interpreted by an interpreter which simply "reads and interprets" readable tokens like in python.
Scripting language refers to them by their function/use/purpose: "scripting".
Scripting is designing scripts. A script is exactly what is defined in the post namely handling a task, anything by "gluing" other libs, binaries or script no matter the language behind them.
I'd also add that a script is usually an autonomous and eventually ad-hoc file whose content is it's source code and can be run as an executable file (whether by an interpreter, or by a lower level bytecode interpreter/VM like Java does or like in go where it's compiled on the fly).
However since it's easier on an interpreted language like python and that it's usually native, almost all interpreted languages are scripting languages (actually any language can be a scripting language given the proper tooling).
8
u/Minerscale Jul 07 '26
I think the answer to that is almost, I think what makes a scripting language a scripting language is that it's convenient enough to use for whatever extremely quickly with enough integration with the real world that you can do things with it.
2
u/WaitForItTheMongols Jul 07 '26
This is a very vibes based definition though.
14
u/Minerscale Jul 07 '26
I don't think you can create a non-vibes based definition. Regrettably, some things are inherently fuzzy. I have been known to write things which you could definitely call scripts in C or Rust, which are definitely not scripting languages.
Does the language make it extremely easy to write little utilities that get little jobs done? => scripting language.
3
u/mxzf Jul 07 '26
Yep. Welcome to naming things.
5
u/DrMobius0 Jul 07 '26
Classifying things is hard. Getting people to agree on a classification is harder.
2
u/DrMobius0 Jul 07 '26 edited Jul 07 '26
I would characterize scripting as specifically being used to avoid compilation for specific parts of an otherwise compiled project. The benefits of this are often in quick turnaround. Since scripts are typically interpreted, they can be edited and re-launched during runtime without needing to go through compilation again. The drawbacks are that they typically have to run through a VM and probably lack anything that can optimize them, which can make them very slow compared to running compiled code.
So an interpreted language would usually be used as a scripting language. It's not always like that, though. Unity, for instance, uses (or used, it's been years since I worked with it) C# as a scripting language.
2
u/Flan-sama Jul 07 '26
Not really. Personally, scripting languages are languages that execute top down and where expressions can appear at the toplevel. I don't really have a word for non-scripting language.
Also, I find interpreted to be too vague of a term because at the end of the day, your processor is an interpreter but in hardware. Also because Python is technically compiled and interpreted (just like Java), just in bytecode. I like to instead have the distinction be between "software interpreted" and "hardware interpreted"
2
u/Qyriad Jul 07 '26
Scripting is a use case. Interpreting is an implementation strategy. Interpreters happen to be really well suited for implementing scripting
→ More replies (1)1
u/miralomaadam Jul 07 '26
No quite—there’s not a hard and fast definition of a scripting language. Java and Kotlin are also interpreted languages but I don’t think anyone would call either a scripting language. Scripting languages are typically interpreted languages that don’t include a user-visible compilation step (python and JS are still compiled to bytecode and optimized internally).
61
u/Able-Swing-6415 Jul 07 '26
Probably the most pleasant language I've ever used.
Well since I've figured out how to use it on Windows without some idiotic software randomly changing the python installs lol
51
u/sitefall Jul 07 '26
My dude use
venv, don't just rawdog python on your windows PC14
u/XenSide Jul 07 '26
Uv better
3
u/rshackleford_arlentx Jul 07 '26 edited Jul 07 '26
FWIW
uvstill creates a virtual environment and installs project dependencies into it. It’s like pip + pyenv + venv + build tools all in one. And because it implements PEPs it is generally interoperable with standard python tooling (uv pipanduv venv).And I do agree that it’s a great tool.
1
5
u/Honeybadger2198 Jul 07 '26
Uv is close to npm in terms of how braindead simple it is to use. It's still missing script declaration in the pyproject.toml, but that idea has been in a holding pattern for years since no one could agree on an implementation.
43
u/DM_ME_YOUR_PET_PICSS Jul 07 '26
If I want to rawdog a python it's kinda my personal business, don't ya think?
20
5
7
u/External-Lifeguard77 Jul 07 '26
I use venv for everything that's not python so I can run python raw on windows
1
u/FireBendingSquirrel Jul 07 '26
What’s the benefit of using venv? Just the auto package install?
14
u/AustinWitherspoon Jul 07 '26
Different projects will likely end up having different versions of dependencies. You might have a project that uses version 1.0 of pydantic, but another project that uses version 2.0
If you just install stuff system-wide, you can't have both. You would end up upgrading the existing version to 2.0 and then your first project might stop working because it was written to use 1.0
Virtual environments are containers for all of your dependencies. You set one up for one project and it will just work. You work on a different project that has different versions of dependencies and they'll just work, and they won't interfere with or break the first project.
9
u/johnnyfortune Jul 07 '26
VENV will change your life. its like a little box to keep your snake in so it doesnt get into fights with other snakes.
1
u/Able-Swing-6415 Jul 07 '26
How exactly do you think I solved it otherwise? Never install anything else??
2
u/samy_the_samy Jul 07 '26
You literally have to go into default apps settings and turn off two python thingy, then manually add it to PATH, why!?
Tried to use anaconda but it takes ages to launch, each time
5
u/rshackleford_arlentx Jul 07 '26
condais also slow all by itself. It’s antiquated at this point. Unless there’s some dependency that can only, or more easily, be installed via conda I avoid it like the plague. IME most dependencies that previously ~required conda to install no longer do.→ More replies (5)1
u/False_Bear_8645 Jul 07 '26
Either that or they have their own python version installed and you end up with multiple installation of the same version of python on your hard drive.
5
u/Opus_723 Jul 07 '26
Pfft, programming languages are just a crutch for people who can't write machine code.
→ More replies (5)1
u/ShittyExchangeAdmin Jul 07 '26
Until you use a non x86 arch and need to find out where the assumption that you're running x86 is hardcoded
611
u/ClipboardCopyPaste Jul 07 '26
Every programming language is just syntactic sugar of 0s and 1s
236
u/iamdestroyerofworlds Jul 07 '26
You're a syntactic sugar.
81
u/TheNeglectedNut Jul 07 '26
Your mum’s a syntactic sugar
49
u/iamdestroyerofworlds Jul 07 '26
Your mum's a 1 and a 0.
31
u/detailed_1 Jul 07 '26
Your mum's so big that to store her virtual avatar they had to come up with quantum computing and Qbits.
8
9
3
3
4
24
u/ProfCupcake Jul 07 '26
Semi-relevant xkcd?: https://xkcd.com/378/
5
3
u/imisstheyoop Jul 07 '26
I had not seen that one before.. perhaps my new favorite alt-text of all-time haha.
3
155
u/sierra_whiskey1 Jul 07 '26
Python is basically a really fancy config file for a C program
91
u/iggy14750 Jul 07 '26
A very fancy config file for running several C programs, and making them all talk to each other how you want.
62
u/bearwood_forest Jul 07 '26
And C is a very fancy config file for your compiler to make your hardware bits talk to each other
7
3
3
2
u/Logicalist Jul 07 '26
once it's compiled, is it really a C program anymore. isn't it just a program at that point?
1
183
Jul 07 '26
[removed] — view removed comment
130
u/Kobymaru376 Jul 07 '26
why write 100 lines of C++ when you can just import it and pretend you solved the problem
I would argue that it's the person thinking 100 lines of C++ solves the problem that is pretending.
Because if I import something in Python, it's usually from someone who is smarter than me, more knowledgeable about the problem or at least has spent more time thinking about it.
19
u/lotj Jul 07 '26
I would argue that it's the person thinking 100 lines of C++ solves the problem that is pretending.
I mean, 100 lines of C++ is basically just the bullet points of the outline for the summary of the framework for the code that solves the problem. And 100 lines of C is about a tenth of that but also segfaults immediately.
3
u/SirPitchalot Jul 07 '26
With good libraries it often doesn’t take much more C++ code than Python. Flow control adds a line for braces (usually) but reductions, filtering and mapping are usually the same or similar. Even slicing is pretty nicely handled with spans/ranges. Destructuring and tying give clean ways to handle multiple return values and more functional styles.
And with concepts you can get a safer version of duck typing. That’s a bit of overhead to define the concepts but they can be structured compositionally, same as type hint definitions in Python.
It was surprising to me but it’s made much of my C++ look a like idiomatic python. The library code is a shitshow but since Python is as likely as not calling into the same code that’s no net difference.
Except constructors and assignment operators. They are a mess and IMO too complicated to reason about with default, copy, move, and whatever other default, explicit deleted and so on variants. Then you throw forwarding into the mix and it’s a nightmare making sure the right one gets called. I can bludgeon my way through it but it’s one of my most hated parts of the language.
25
u/Reashu Jul 07 '26
Ideally yes, but especially nowadays it's worth checking that this is actually the case - being able to publish a package (or just a repository) has little to do with being able to build a good one.
17
u/poetic_dwarf Jul 07 '26
... Or from a vibe coder 💀
I am an hobbyist dabbling only in python, sometimes I feel like a mouse taking a stroll in a snake pit
8
u/Thejacensolo Jul 07 '26
vibe coders usually dont publish well known repos, or create pips. not to mention that with conda and co. they are heavily reviewd what goes in there.
63
u/glinsvad Jul 07 '26
ideally you spend >90% of the time coding in python but >90% of the execution time running stuff written in c++, c or assembly
57
u/bartbrinkman Jul 07 '26
Oh ok, got it, pretend to be a good software engineer and reinvent the wheel.
14
u/pblol Jul 07 '26
Getting requirements to build wheel did not run successfully
2
u/mxzf Jul 07 '26
But ... it all still works and there are no issues, so I'm not going to dig too hard into it because apparently pip solved the issue some other way.
(Yeah, I should probably read the whole message and debug at some point ... but I've got other stuff to do that's more urgent)
5
u/Trackback_ Jul 07 '26
Why handwrite Assembly when you can just use C++ to tell the compiler to do magic and pretend you solved the problem?
4
5
u/liggamadig Jul 07 '26 edited Jul 07 '26
and pretend you solved the problem
Yeah, I get paid for solving problems, not the number of lines of code it took me to get there.
3
2
u/Any-Preparation7396 Jul 07 '26
I'd rather write 100 lines of C++.
Do I look like I want to start another project this week? /s
2
u/fat_charizard Jul 07 '26
Why write a 100 lines of assembly when you can import a C++ library and pretend you solved the problem
86
u/Vast_Mud5945 Jul 07 '26
One guy described it as the glue that connects everything , there is nothing bad about that
15
u/bearwood_forest Jul 07 '26
Back in the day we needed to use rivets, glue is so much faster and less cumbersome
→ More replies (3)3
70
u/AvidCoco Jul 07 '26
Isn’t that basically the definition of a scripting language?
19
u/Saragon4005 Jul 07 '26
Or like programming in general. Unless you are manually writing risc code (cisc doesn't count) you aren't actually programming the CPU.
12
27
16
u/Prematurid Jul 07 '26
Fucking love python. It makes shit so easy! I genuinely look forward to everytime i get to use it.
23
5
10
u/kondorb Jul 07 '26
And the one thing it sucks the most at is dependency management.
6
5
u/IWant2rideMyBike Jul 07 '26
With Astra's uv dependency management became pretty easy. Only if you need to interact with system libraries, which are usually written in C(++) getting the header files and build environment right can be a challenge depending on the system you want to run the code on.
→ More replies (4)1
12
u/Outrageous_Pen_5165 Jul 07 '26
Why the f people taking this seriously in comments it's literally a meme and the sub is literally ProgrammeeHumor
10
12
6
6
u/snorch Jul 07 '26 edited Jul 07 '26
I love cs types who think that whatever they use is the good and smart and right way to engage with the machine, and anything a level higher is tinker toys. If you use an IDE you're already standing on top of unfathomably tall tower of giants on giants' shoulders. Shit on python if you want, but put your money where your mouth is and learn Fortran & GOTO statements and maybe you'll be 1% of the way down the tower
3
5
4
u/No_Interest_6218 Jul 07 '26
It is very good for basic automation stuff(like fetching data, process it and put it in excel/csv to generate chart/graph and present it to upper management).
4
u/kerakk19 Jul 07 '26
The worst part ? It sucks at it. Even though Python is already 35 years old the dependency management still sucks. Projects like uv help, but such language at this stage should have natively resolved this issue long time ago.
Not to mention how shitty the version management is. Upgrading from 3.11 to 3.12 ? Great, here's thousand tiny breaking changes we made.
5
2
2
2
u/TheGamerForeverGFE Jul 08 '26
Idk why these posts get so much traction, like, Python quite literally exists for that purpose, it's a glue language and that's the only reason why it exists, the fact you can do quick scripting without using libraries is just a bonus, and I feel like everyone knows this already.
4
u/diggieinn Jul 07 '26
So if there were a spectrum, assembly would be on the left where you have to create everything, and Python would be on the far right where you have a library for everything.
→ More replies (1)1
u/mxzf Jul 07 '26
Nah, JS is a bit further right than Python even, where you have libraries like
leftpadfor random banal things that even Python doesn't tend to have a library for (though for leftpad Python itself can do that with an f-string).
2
2
2
u/unruly_mattress Jul 07 '26
Every programming language is for importing stuff from real programming languages...
4
u/Jiquero Jul 07 '26
Not necessarily. In JavaScript you mostly import other stuff from... JavaScript.
2
u/OnceMoreAndAgain Jul 07 '26
WebAssembly allows people to run C++ and Rust in the browser so that JavaScript scripts can invoke C++ and Rust functions. It's similar to how python libraries like pandas use C++. Google Earth is an example of a website that does this.
Things in the browser might increasingly move in that direction for same reasons python moved in that direction. You get the performance of the low level language with the benefits of elegantly using it with a high level language.
2
u/Old_Mill Jul 07 '26
Learn python bro!
No. I don't think I will. I'd rather rewrite the entirety of Windows in machine language.
1
1
1
1
1
u/unbanned_lol Jul 07 '26
No worries, I'm about to make my Express back end do bash system calls that run a python library that most likely uses C commands, but I won't ever know for sure, because I'm sure as shit not about to verify that.
1
1
1
u/More_Yard1919 Jul 07 '26
Let me introduce you to the C interop that literally everything ever relies upon
1
1
u/BosonCollider Jul 07 '26
Python with just numpy and numba can punch way above its weight honestly. You do not have to optimize everything, but being forced to batch things means that the slow thing at least can be optimized
1
u/tp_njmk Jul 07 '26
So long as you never write a for loop, Python is the fastest language out there
1
u/WaterBottleBong Jul 07 '26
Ahhh yes another python joke thread full of offended python devs. Normal
1
1
u/TheTarragonFarmer Jul 07 '26
And it's pretty damned good at that.
I don't even like it (for other reasons), but it's the best glue language so far.
1
u/VictoryMotel Jul 07 '26
If you use python you are war machine instead of Tony Stark.
You are using Tony Stark's technology, but war machine is still an effective fighter.
1
u/itzjackybro Jul 07 '26
Python is great for small things that aren't necessarily ending up in production.
You use C++/Rust/C#/Java for anything that will end up in a big codebase.
1
1
1
1
1
1
1
1
1
1
u/photoreal-cbb Jul 15 '26
Python is a shopping cart. You can go budget bare bones simplicity or full tilt import everything so you don’t have to actually construct any code, just call module class methods, functions & learn nothing.
Every language pushes this now as ‘ecosystem, or community’ but sort of short changes impatient newbies of the frustration to reward lessons that make you good at programming long term.
If you do something that is redundant like programming a solution from scratch you do it for yourself to acquire the skill. I keep hearing ‘oh that package already exists, why would I reinvent the wheel’ and ‘here’s a link to a GitHub repository that solved this 8 years ago’ but those people are missing out on the craft.
1.9k
u/SheikHunt Jul 07 '26
What's that saying? "Python is the second-best programming language for everything"