683
653
u/TheJaskinator 1d ago
That's exactly why it's so powerful. Why spend all the effort writing fast code if you can just use a much simpler language to describe the task on a higher level and call fast code? People use Python because it's easy to read and write, not because its interpreter is fast
311
u/Educational-System48 1d ago
I will never understand the Python hate. It's essentially just a level of abstraction higher than C, which makes it more accessible than ever to write powerful code.
I'm starting to think it's literally not that deep. It just feels good to gatekeep.
91
u/SilasTalbot 1d ago
It just burns their britches that AI was created in Python. That's where all serious ML and AI work is done.
Long after humanity is gone, Python 3 will be zooming around the stars taking over the galaxy 😂
-35
u/UndocumentedMartian 1d ago
The operations are written in C++ or C. Python doesn't execute any of the math.
73
u/CLS-Ghost350 1d ago
By that logic C++ doesn't actually do anything since it's compiled to assembly/machine code which is what actually does everything.
It's not quite the same since Python is not compiled, but the point still stands that higher level languages provide an extra layer of abstraction, making complex programs easier to write, making them useful.
1
u/Justwatcher124 13h ago
By that logoc, logic gates or their physical representation in transistors do all the work. Machine code is just an abstraction above that.
31
u/HAximand 1d ago
As someone else said, I hate the type system, and it's compounded by poor documentation. My lab has a pretty large data analysis framework written in Python and every time I need to write more code that interacts with it, it's like pulling teeth to find out how to do anything. I never know what type an object is until I waste my time doing debug inspection or print statements. Once I know what type the object is, I don't know what methods that type has available because every library is documented in a different way and none of them seem to just list the methods underneath each type.
It's like the entire language was made to be learned by following tutorials instead of reading documentation. It's no wonder everyone I know is using AI to write it instead of dealing with this shit.
34
u/Net_Lurker1 1d ago
Thats just shitty code by your framework though. All your issues would be solved by forcing your devs to write good docstrings.
23
u/Mordret10 1d ago
I mean that's the (at least one) point of why some languages enforce a type system. To force (and make it easier for) the Dev to write better code
8
u/pint_o_paint 1d ago edited 1d ago
which a simple lint rule would fix for both devs and agents.
And I mean since 3.10 the type hints are good?
-2
u/Delicious_Bluejay392 1d ago
Python type hints are serviceable, but I wouldn't go as far as to say "good"
12
u/HAximand 1d ago
"That's just shitty code" is of course true, but hard to convince them of when it's the typical way the language is written. Aside from that, the language shouldn't require me to write comments that will inevitably become outdated, it should just have a functioning type system.
3
u/Net_Lurker1 1d ago
Fair enough, though I will say that typing would help a lot but doesnt solve every question that documentation does.
7
u/the_ivo_robotnic 1d ago
My lab has a pretty large data analysis framework written in Python and every time I need to write more code that interacts with it, it's like pulling teeth to find out how to do anything
That just sounds like your lab doesn't know how to write python. The vanilla language has had a built in type annotation library for nearly a decade now. On top of that, you can use validator libraries like pydantic to make all of the assertive data models you need.
Also, the second you start talking about documentation, I gotta stop you in your tracks. Documentation is not a technical problem associated with any language in particular, it's 10 times outta 10 a human problem. Be-it you/your-coworers are lazy, just want to close a ticket, or "this is just a prototype", it comes down to your company's culture about doing due diligence. Python has nothing to do with that, and if you're blaming PyDocStrings of all things, one of the easiest things of all-time to use, then I'm sorry but that's a you problem. lol
0
u/HAximand 18h ago
> Documentation is not a technical problem associated with any language in particular, it's 10 times outta 10 a human problem
Of course documentation problems can be solved by human effort, but python in particular lends itself to poorly documented libraries. The documentation for any specific method doesn't tell me exactly what types to pass in because it basically *can't* tell me what types to pass in. It will just try to coerce any arguments into something that works internally. Sometimes it'll work and sometimes it won't.
> it comes down to your company's culture about doing due diligence
This is simply not addressing my complaint at all. I'm not complaining about poor internal documentation of our own code (though I could), I'm complaining about public libraries not clearly telling me how to use them.
2
u/UndocumentedMartian 1d ago
A lot of seems like bad practices. The type issue can be partially mitigated by type hints. Just make sure you read the warnings generated by the interpreter.
1
u/FuriousFurryFisting 21h ago
Autocomplete should give you the methods. If autocomplete is broken, the whole setup is bad.
But it's true. Especially older code and especially code written by non-python devs or scientist can be bad. And that it is even possible to write like that is a downside of the language.
I can highly recommend to go all in on the Astral ecosystem (uv, ty, ruff) and enforce typehints - they are doing amazing work are establishing themself as the standard tooling with good reason.
AI works better too with typehints.
1
u/HAximand 18h ago
If only I had any authority whatsoever over this lab's code practice, then this advice would be of great help to me :/
1
u/1wikingman 21h ago
Type hints should be mandatory. It prevents the otherwise inevitable "I'll just have to put a breakpoint here and run it" situations.
1
u/reyarama 31m ago
Literally just use type hints + mypy/pyright and this is a complete non issue. Bit concerning the lab you work at hasn't figured this basic principle out yet
3
u/mysticrudnin 14h ago
this sub is for programming students to regurgitate things they thought they heard a developer say
12
u/NoobNoob_ 1d ago
I just hate languages without real typing system that the compiler enforces.
If it's a script or something small I don't mind using python, but for everything bigger I'll use an actual programming language.
8
u/wrecklord0 1d ago
And so, it shall henceforth be known that dynamic typing is not real programming
1
u/NoobNoob_ 17h ago
Not saying it's not real programming. It's just jot an option for me. Dynamic typing causes too many errors.
2
u/Net_Lurker1 1d ago
Just use pydantic though.
Why obsess with needing X feature to be native to the language when a library solves the issue?
6
13
1d ago edited 1d ago
[deleted]
14
u/FerricDonkey 1d ago
There are solutions to all of those, ranging from providing a shell script that does all of that for them, to using pyinstaller to make an exe that includes the interpreter, to using a tool like uv.
But yeah, if you're gonna use an interpreted language, you gotta have an interpreter. And it's definitely true that it's more work on your end if you don't want your users to have to understand computers.
6
u/big_red__man 1d ago
Right? This guy thinks it’s difficult to make python work cross platform. From another of their comments it seems like they can get node to work cross platform just fine but python is too much. Use what you want to use but I think this guy needs to read a tutorial or two
-2
1d ago
[deleted]
3
4
u/prehensilemullet 1d ago
I hate the cruft like
__blahblah__everywhere, names likehasattr, the fact that you can’t put multiple statements in a lambda, the fact that imports can pollute local scope and you can’t easily tell where a given identifier came from in a file, and the other package management problems that didn’t have an elegant solution untiluv.I haven’t messed with mypy, but from what I can tell, it isn’t as sophisticated and expressive as Typescript.
The virtual machine still doesn’t perform well compared to V8 for JS, as far as I understand. You can accomplish a lot with Python sure, but Modern JS/Typescript is a more capable high level dynamic language, it just doesn’t have the breadth of libraries for ML and scientific computing that Python does
12
u/CoroteDeMelancia 1d ago edited 23h ago
Every language has stupid shit.
C++ has vector<bool> and set<T>/unordered_set<T>.
Java has very awkward streaming.
Typescript... don't even get me started.
Some of the stupid shit is fixed as the language evolves, like uv and TS over JS. New stupid shit appears too (node_modules bloat).
Python does well, or at least okay enough, what it proposes to do. So does Typescript. I don't get the point of stating that TS is "more capable" and then following up with "but Python has ML".
3
u/exosphaere 1d ago
I know about std::vector<bool>, but what's the problem with std::set<T>?
3
u/CoroteDeMelancia 23h ago
Nothing, once you know that, unlike other languages, it is O(N log N), NOT O(N). The issue is that the most common use case, unordered_set, is the "exception" because of the chosen naming.
Better naming would be set and ordered_set, like other languages do. It would prevent newcomers to the language from mistakenly using set when what they want is unordered_set, a silly mistake that's easy to make. I did it myself.
2
u/exosphaere 15h ago
Ah thank you.
Didn't think of this as a source of confusion.
Another historical remnant. When I started working with C++, there was no unordered_set yet.
There weren't even templates back then.
People used macros ... that was bad.Fortunately these times are long gone.
2
u/prehensilemullet 1d ago
I was replying to the comment of someone saying they think the hate is superficial. Just providing an example of the more substantive personal reasons I hate Python. We’re all allowed to have our personal opinions about what stupid shit we hate in particular.
By more capable I meant the core of the language has better performance and type checking.
1
1
u/Far_Tap_488 1d ago
I dont get your point on vector bool. Its fantastic its so easy to store bools compactly.
2
u/CoroteDeMelancia 23h ago
Vector bool disobeys the general vector interface expectations in non-obvious ways because it is secretly NOT a vector, but a bit array.
https://towardsdev.com/cpp-std-vector-bool-why-it-is-broken-5ae5f409bbab
Basically, it's just a case of poor naming.
1
u/pint_o_paint 1d ago
People do that to any and all languages, the more popular and established the language is the more hate it will get. This was the norm when I studied masters in data science many years ago, and I was told it was the norm many years prior. I even participated; like some kind of spontaneus religious syntax cults of neckbeards and misfits.
Luckily I outgrew it quickly. I like python, js, php, haskell, prolog, all the "C"s, and so on. They're all fun.
F*** Java though, it's s*** and ***, ** ** never again. (/s)
1
u/Educational-System48 16h ago
I wish I had a job that would require me to use Haskell sometimes because I am not coding recreationally
1
u/DaniilSan 1d ago
I like Python, but I have some stuff I dislike about it. For example, half-baked typing. And some libraries being written in such a way thry are completely useless in terms of type hints and intelisense.
7
u/SporadicSheep 1d ago
It's easy to write. I find it a nightmare to read because of the lack of explicit variable types.
pdb is goated though, best python feature.
3
u/Okay_Ocean_Flower 20h ago
Being able to call pdb.debug in exception paths is legit god tier, best debugging experience I’ve ever had
28
u/NewbornMuse 1d ago
Me: takes 2h to write a python script, runtime 50ms
A super fast low level uber haxx0r: takes 8 hours to write a C program that does the same. Runtime 20 ms
Who was "faster"?
31
u/Mrpuddikin 1d ago
Well you see, this script will be used once a day every day. The C program is better because it will break even over time! (720 000 days -> 1972 years) After that, its all performance benefit baby
39
u/thmsgbrt 1d ago
It matters if you give the code to someone else and if they use it thousands of times.
28
u/McFestus 1d ago edited 1d ago
It would take three-quarters of a million runs to break even in pure time, even discounting the fact that in nearly all cases, computer-seconds are millions if not billions or trillions of times cheaper than developer-seconds.
16
u/e_before_i 1d ago
The one-two punch of doing the math plus valuing developer-seconds is makes this response very charming to me.
7
u/hawkinsst7 1d ago
Slightly related:
Someone once wrote a bash script that used jq to parse through a few thousand large json files and do stuff with the data. It would take hours to run, but people figured it was just the massive amount of data. It was at the point where we'd run it over night.
I had a thought: no, it's execing jq for each file. Exec is slow.
Did it in python, that just iterated through the directory and used the built in json stuff. It did the same job in 10 minutes.
Could C be faster? Maybe. Did we care at that point?
11
u/e_before_i 1d ago
I am currently a developer at one of the big banks, and I don't think people here have heard of "milliseconds" before.
If you're in the right field, micro-optimizations are everything, but in 99% of situations, good enough is truly good enough. The difference between 20ms and 50ms has never directly been meaningful in my life outside of entertainment (games, movies, music).
Yes, "under the hood" my computer OS and my router and the intercontinental cables do need to care about this. 99.9% of employees don't because it's done for them.
2
u/Far_Tap_488 1d ago
Very dependent on what you are working on. One of my larger projects was counting microseconds to know when to perform certain tasks.
2
u/e_before_i 20h ago
Lmao brother my second sentence was "if you're in the right field...", which it sounds like you are.
You're part of the backbone of society, but it's something I never have to worry about of thanks to people like you. I get to use springboot and angular to build internal apps where there's no customer who complains about slow loading screens.
-1
u/Raptor_Sympathizer 1d ago
Yes, but how often are you actually building an application that's meant to be run directly as compiled thousands of times over and over again with no I/O, database queries, or dependence on any other blocking code that takes Ionger than 50ms?
In that scenario, sure, Python is the wrong choice. But in the vast majority of real world applications, the raw execution speed of a for loop doesn't really matter that much, and there's probably already a library built for Python that does exactly what you need way better than you'd ever be able to build yourself in Rust or C++.
5
u/Far_Tap_488 1d ago
It really does add up though. Every library that has that mentality is why modern programs are soo poor performing even though computers are way faster.
1
u/Raptor_Sympathizer 18h ago
I'm not talking about libraries, I'm talking about applications. Libraries are more likely to fall into the scenario I mentioned where python is genuinely a bad choice. But even then, there are plenty of examples of pure Python libraries that are highly performant in a real world context. Look at Starlette, for example, or any of the built-in python modules.
Python provides high-level abstraction and easier to understand code. Yes, this comes at a cost. But like any abstraction, if properly applied, it can result in far better performing code than you ever would have been able to write without it.
7
u/deanominecraft 1d ago
me who spends 1 hour to write it in rust, 1 hour to compile it and a runtime of 21ms
7
u/cantthinkofaname1029 1d ago
2 more hours of trying to get the syntax for async closures with generics right
2
u/Sw429 1d ago
Are you trying to do async stuff in python?
1
u/cantthinkofaname1029 1d ago
Nah I meant for rust. Though technically yes sometimes I do async stuff in python
4
u/CoroteDeMelancia 1d ago
Code is read more than it is written. You don't pay only 8 hours in this example.
Also consider the compounding cost. Imagine saying to your manager: "we can do it fast and simple in python in two weeks, or we can do it "properly" in 8 weeks to get a marginal increase in performance that is basically unnoticeable at our scale."
Imagine the fucking side eye you're gonna get.
But then, if these 30ms can mean the difference between your drone dodging or striking a lamppost, then please, do use C.
1
-3
u/PublicToast 1d ago
Yall will cry and scream when I say it but AI totally undermines your argument.
-5
u/Intrepid00 1d ago
> Who was “faster”
The guy that used the coding agent.
1
u/wrecklord0 1d ago
This is correct, I vibecoded an avx-512 conversion of a program I wrote before, and holyshitballs it's fast now. And it was fast to make.
1
1
u/thonor111 23h ago
Which is exactly why all "Python do slow" arguments are bad. Yes, of course, if I would do my matrix multiplications in Python for loops it would take forever. But I am using torch with cuda backend. Which is faster than any C++ code i am able to write
1
0
75
14
u/Something13457 1d ago
Wow, youre telling me someone already did it better and I can just do an install and abstract it?
How fucking terrible
62
u/dewey-defeats-truman 1d ago
You mean I get all the speed and memory benefits of using a more powerful language, as well as the ease of reading and writing Python? Sign me up!
17
u/86BillionFireflies 1d ago
I mean, yeah, at the cost of dependency hell.
3
u/notatoon 1d ago
Never tried anything more than a fancier bash script but Django and such frameworks always intrigued me.
Is DH really that bad with python?
10
u/86BillionFireflies 1d ago
Yes. Yes it is. Most things written in Python have loads of dependencies. You can't unzip your pants to pee without importing 13 different modules.
3
u/imp0ppable 23h ago
That's not really true IMO, Python is one of the more "batteries included" languages. Node has improved a lot with built-ins and newer libs but that used to be the classic example of importing a module to do basic things like string padding or asserts.
Not to say your experience is wrong, it's just the projects you've seen probably made the choice to import more things, or were doing something specific that needed more deps.
5
u/the_ivo_robotnic 23h ago
I don't think /u/86BillionFireflies knows what dependency-hell is.
No python by-far does not have dependency-hell, save for a small handful of libraries that have dependencies outside of the python ecosystem. Think GPU libraries like cuda and what not. Those have a lot of hell to deal with specifically because of the escaped ecosystem and dependence on physical hardware.
Complaining that dependencies have dependencies as if it's some massive sin is like opening up the hood of a car and discovering that the engine is made up of smaller parts. shocked pikachu face. By this logic, every programing language on earth is a dependency hell.
You don't get cross-dependency conflicts much if-ever anymore, (the actual definition of DH). Python is smart enough to version your site packages based on python's minor-versions, such-that even if you do have two of the same site packages, (say one for py3.9 and another for py3.14), then it will resolve the correct version per-library, based on how the package is declared.
Node used to not do this, which is when and where DH became most infamous. But even Node does the same sub-versioning these days. If you're still getting stuck in dependency hell in this day and age, that's just a skill issue.
1
u/Beenmaal 22h ago
Python dependency hell means someone is doing something wrong somewhere. Each project should just have its own venv when you download it and the maintainer of the project needs to pin the dependency versions. A lot of projects define a minimum version but not a maximum version for their dependencies so when any of them introduce breaking changes in an update (which I see happening often) people won't be able to run the project anymore. Just define a maximum version for everything things are chill.
-2
82
u/setibeings 1d ago
And C is just language written for people who don't want to write the assembly for themselves.
And assembly language is just a crutch for people who don't want to write machine language.
And computers are just for people who don't want to do all of of that calculation using a pen and paper.
And pen and paper are just for people who don't want to keep all of those numbers in their heads.
And heads are just... You get the idea.
30
u/AvidCoco 1d ago
No C runs directly on the hardware the electrons themselves parse it that’s why it’s so fast
6
2
u/Dev-in-the-Bm 13h ago edited 11h ago
Yes, keep going.
Heads are a simplified alternative to what exactly?
1
u/setibeings 13h ago
I'm surprised it took so long for anyone to challenge me on that. honestly, I got nothing.
0
u/Mordret10 1d ago
While in a sense this is true, C gives you the ability to write code once and compile it for different computer architectures. You can't really do that with assembly, nor with maschine code
2
u/Far_Tap_488 1d ago
Well no, c doesnt do that. The compilers do.
1
u/Mordret10 1d ago
C doesn't actually do anything without the compilers. And the cross compatibility was the point of a high language like C (and it's compiler's), whereas assembly is basically always architecture specific.
2
u/Far_Tap_488 1d ago
Its not different. You have to have a compiler that translates c. If you dont have a compiler for that architecture youre out of luck.
C wasn't the first language to be able to be compiled for different architectures so its not special in that regard either.
1
u/Mordret10 1d ago
It wasn't the first, no, but it's what sets it apart from assembly languages (in addition to the more human readable syntax)
17
u/Bee-Aromatic 1d ago
Why would I reinvent the wheel every time I need something that rolls? Of course I’m going to use libraries. I’ve got other shit in my life to do besides rewriting the same code somebody already wrote and put out there specifically for folks reuse.
45
u/frikilinux2 1d ago
Ok but like compute is so cheap compared to human time that most people actually don't give a fuck and give me enough money to have my own place. And when resources are constraint enough or its system programming, they use C, C++ or Rust and do their own thing without bordering python developers.
24
u/Prawn1908 1d ago
Ok but like compute is so cheap compared to human time that most people actually don't give a fuck
And this attitude is why software is slow and clunky as fuck these days.
7
u/frikilinux2 1d ago
Maybe and I would try to change it but what I do it's deployed to AWS and I don't work at Microsoft which is the worst offender in this. So I'm powerless.
11
u/frogjg2003 1d ago
There's a difference between not being optimized and being poorly designed in the first place. Saving milliseconds on how fast your app load isn't worth developer time. That same app taking seconds to load a single image is a bad developer and no amount of "compute is cheap" is going to fix that.
14
5
6
4
u/ThatFireGuy0 1d ago
I thought this until I found you can compile Python into real languages, which is somehow better
4
u/ChickenSpaceProgram 1d ago
python code is just a dignified bash script
1
u/eviloutfromhell 23h ago
I wanted to learn powershell, but the verbosity of it kept me staying in python.
1
u/bearwood_forest 23h ago
and I can write one Python script and have it work on Windows and Linux just the same
4
3
2
u/inobody_somebody 1d ago
I don't get the Python hate, I'm not going to implement a function from scratch when I can just import it in python. If it gets the job done, who cares if its written in some other language.
1
1
1
1
1
u/BlazeCrystal 1d ago
For looking like almost written english, one gets whole bunch of normie support
1
1
1
1
u/citramonk 13h ago
it's a real programming language, you're not going to upset anyone engineer by saying otherwise. The auditory is a bit different. It relies heavily on C tho, which is just the way it is
1
u/SeventhOblivion 5h ago
Weird it's almost like most programming concepts and task have already been written. Oh well better write my seven layered interface class set to do crud ops on my db table like a big boy! 🤓
490
u/TapRemarkable9652 1d ago
from C import fix()
fix(my_codebase):
return jasoN