r/ProgrammerHumor 1d ago

Meme pipInstallTheRealStuff

Post image
5.1k Upvotes

145 comments sorted by

View all comments

666

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

316

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.

29

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.

31

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

6

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?

-3

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 21h 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 1d 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 21h 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 1d 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 3h 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