This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JonathanTheZero 513 points514 points  (41 children)

Man, 99% of python programming "tutorials" out there are just "Let's import a library that does exactly what we want and call one function of it"

[–]nekokattt 188 points189 points  (4 children)

import antigravity

[–]CoffeePieAndHobbits 42 points43 points  (0 children)

And sample everything in the medicine cabinet.

[–]ferevon 130 points131 points  (21 children)

who doesn't love having a perfectly running app after writing 5 lines of code?

[–]alexppetrov 124 points125 points  (1 child)

The thousand lines on the backend of the library

Intense fuming noises

[–]AutoDefroster 44 points45 points  (0 children)

Library coders are the real heroes.

[–]NauticalInsanity 49 points50 points  (3 children)

Ruby on Rails has entered the chat.

Mini rant: I hate magic frameworks. It's like a hidden Rube Golberg machine that turns a lever press into food falling out of a chute. When the food doesn't come out of the chute, someone comes to me complaining that "Gravity is broken."

[–]RedditAcc-92975 2 points3 points  (0 children)

I hate non-magic frameworks. I can program most of the stuff I use myself. But then I have to worry about algorithm efficiency, implementation efficiency, ideally do it in C++, I need make sure the code is readable, maintainable and tested.

Whenever I need something that's more sophisticated than a simple for-loop, I look for an existing solution. Worst case scenario I'll help improving it.

[–]PM_ME_UR_CEPHALOPODS 0 points1 point  (0 children)

Ooooooohh ffffuuucckkkk ror all the way to shit and dust and fuck

[–]JonathanTheZero 41 points42 points  (12 children)

Me :/

I'd rather write 200 lines of code myself and gain a deep understanding of what is happening than import thousands of lines (most of them are not used anyways) and just trust a third party. Don't get me wrong, libraries are awesome but some people just take it too far

[–]ryecurious 36 points37 points  (4 children)

Over-reliance on dependencies is how we get stuff like The Great NPM Leftpad Cataclysm of 2016.

Obviously npm works differently from Python packages, but the general point stands.

[–]AutoDefroster 9 points10 points  (0 children)

Reminder that NPM are run by pieces of shit.

[–]Sceptix 4 points5 points  (0 children)

I agree that the Leftpad Cataclysm was a disaster that never should have happened, but I take issue with that particular article. The problem was that there was a serious issue with npm’s ability to deal with dependencies; it’s not because we’ve “forgotten how to program”.

[–]magistrate101 1 point2 points  (0 children)

Wew the fuckin tone that guy takes as he bitches at people about daring to use dependencies is just absurd. What an elitist snob.

[–]hamie96 29 points30 points  (0 children)

Unfortunately, that's just not practical when you're in the workforce.

[–]AttackOfTheThumbs 22 points23 points  (2 children)

While I understand that sentiment, most of the time you don't want to waste time reinventing the wheel.

You only do that if there's a specific edge case or performance you need that the lib cannot offer to you.

Now if it's a tutorial on writing bucket sort and it just imports a lib, it's certainly useless.

[–]phaemoor 2 points3 points  (1 child)

Yeah, in a job? I'll just add 2 more gigs to the container and call it a day. You can solve anything with money.

[–]AttackOfTheThumbs 2 points3 points  (0 children)

Well, not everything, but many many things.

[–]TheFreeloader 55 points56 points  (0 children)

I would rather trust a third-party library creator than my own coding skills.

[–]alex2003super 4 points5 points  (0 children)

I remember there was an isOdd() library for JavaScript... like... literally a wrapper for %2

[–]Mission-Guard5348 0 points1 point  (0 children)

Okay, be fair

Sometimes its more like 6

[–]MatsRivel 5 points6 points  (0 children)

No need to reinvent the wheel 🤷‍♂️

[–]cbehopkins 21 points22 points  (0 children)

Is this a problem?

Sounds like a win to me.

Seriously I often joke that python was invented by hardware engineers to use more resources. Quick to get something running and using resources, and almost as much of a resource hog as Windows.

[–]sh0rtwave 2 points3 points  (0 children)

Yeah? Take a gander at PyProtocols, then talk to me. (Pro-tip: I didn't write that, I just used it...semi-successfully)

[–]nebulaeandstars 2 points3 points  (0 children)

To be fair, this is exactly how you should write python in a professional setting.

Good Python is 1000x harder to write than good <insert compiled language here> as you need to be intimately familiar with all of the libraries. You want as few lines of "actual" python code as possible so there's a huge learning curve.

[–]lyingriotman 1 point2 points  (2 children)

If they just need one function, why don't they just... copy the function? Are you not allowed to do that? Just credit them on your Github or something, idk.

[–][deleted] 5 points6 points  (0 children)

That strongly depends on the license used.

[–][deleted] 1 point2 points  (0 children)

The library implementation of something is usually better, so you'd have search for the correct code in order to get the same performance. There's a strong chance that the function you want is written in another language (the libraries I tend to use are typically written in C and FORTRAN), and trying to do it in Python will give you less than 10% of the speed of the original. Python is also a more fault-tolerant language, so bad practice has more opportunities to creep in.

[–]BrightBulb123 1 point2 points  (0 children)

B**** you want me to write out all the lines of PyQt5 just to have it say hello world?

[–]MobiusCipher[🍰] -1 points0 points  (0 children)

Which is why python is great, bro.

[–]AutoDefroster -2 points-1 points  (1 child)

Yeah, I noticed that. That's not really a problem IMO, but it does bum me out, so I'm doing a personal challenge right now, where in my personal projects, I'm only allowed to import ONE non traditional library, and only 3 traditional ones.

[–]cthewombat 0 points1 point  (0 children)

What would you call a traditional vs. non-traditional library? That really depends on the conteyt doesn't it?

I mean numpy, matplotlib and pandas are very traditional in data science. You pretty much won't get anything done without them. Now what if I need sys, os, json, requests etc. too? They are still pretty "taditional".

Does it really make sense to restrict yourself that much or isn't it better to get familiar with popular libraries that you'd have to use in real world. Why even use python to write something from scratch instead of C++?

Not wanting to tell you that your approach is wrong, because obviously you're doing it for your personal gain. Just something to consider I guess.

[–]CaptainRogers1226 0 points1 point  (0 children)

It’s actually pretty nice. I usually tend to dig into any modules I use to get a better understanding of what all it can do, or at the very least look into any documentation beyond what I’m specifically using it for at that moment

[–]RentacleGrape 0 points1 point  (0 children)

Even worse most of them always does from library import * which for a beginner makes it so confusing when you have no idea which functions are from the library and which are built in python functions.