4 ms·
> You do not need some 3rd party library to write a command line interface for your python code. > Just learn how to do these things in a simpler way, without
by drewcoo 4y ago
> You do not need some 3rd party library to write a command line interface for your python code.
> Just learn how to do these things in a simpler way, without the extra deps.
That's known as reinventing the wheel. Commonly espoused by people with NIH syndrome.
https://www.techopedia.com/definition/3848/not-invented-here-syndrome-nihs https://www.techopedia.com/definition/3848/not-invented-here...
- gyulai 4y agoImagine some point in history where the wheel hasn't yet been invented. But someone figured out that an octagon works kind of reasonably well as something that you might want to put under your chariot, and the whole world of engineering is under a culture where "reinventing the octagon" is some kind of cardinal sin. Where would we be then? Also: Your reasoning is logically a fallacy. From "people making mistake X tend to do Y" it does not follow that "doing Y is a mistake".
- thombat 4y agoBut now imagine the world of tomorrow, where despite the convenient availability of a range of wheels well optimized for specific roles you get told "that just adds dependencies: any artisan builds their own from scratch" and so you and your customers get to learn the unique quirks and paper-cuts of each wheel of every chariot you sell thereafter.
- gyulai 4y agoI merely pointed out that the "don't reinvent the wheel" knee-jerk reflex that some people are exhibiting in a broad range of situations is an absurd absolute. Negating something and then stating it as an absurd absolute does not prove nor contradict the original proposition. Sometimes it's more economical to reinvent some wheel than not to, sometimes it's not. Sometimes reinventing a wheel leads to a net-improvement in the state of the art of engineering, sometimes it doesn't. That sort of relativism makes for boring reading, but it also happens to be the truth.
- TuringTest 4y agoThat's why the better approach is: learn how to build wheels and how they work, then use off-the-shelf wheels - unless you know that you need some peculiarities that are not found on the market; only then modify those wheels or build your own.
- gyulai 4y agoI'm saying: When you know how to build wheels, you may well want to build your own. If I have old bread and five minutes of spare time and a pan, I'll happily make my own crutons. There might be many reasons for why this might be the right course of action in a given situation. Maybe it's more economical to make more of the resources I already have rather than expend more by buying them at the store. Maybe I like keeping alive the heritage and knowledge of cruton making and will teach my kids how to make crutons one day. Maybe I like not being subjected to worldwide cruton-shortages when they happen. ...I just don't get the universal law of "if there's crutons available at the store, you must never ever make your own", and I don't think it is one. Goldman Sachs thinks that risk management software is so core to their business that it makes sense for them to do it in-house while their competitors used off-the-shelf software. One weekend in 2008, Lehman Brothers collapsed. Figuring out your risks after such an event was something that nobody had programmed into their software. But Goldman Sachs was able to get their people to work through that weekend and know what their risks were when markets reopened on that Monday. In the year that followed, they had one of their best business years and massively outperformed their competitors. "You think reinventing the wheel sometimes makes sense? Haha, well I guess you also think that Google and Amazon should be manufacturing their own computers then..." ...this is something that somebody might have said sarcastically 20 years ago. Well guess what. They are.
- TuringTest 4y ago> I guess you also think that Google and Amazon should be manufacturing their own computers then..." ...this is something that somebody might have said sarcastically 20 years ago. Well guess what. They are. So, if you don't have the resources of Google or Amazon it may make sense to get your wheels from somebody else, right? It's called specialisation of work.
- annowiki 4y agoIts usually not so much "a range of wheels optimized for specific roles" and more "one size fits all." You want a wheel that fits your cart. You have a lathe. Why make do with a wheel someone else made, standardized, and sells to fit a wide range of carts when you can make the perfect wheel for _your_ cart? Most of the functionality in libraries use standard algorithms anyway. I doubt anyone thinks its a good idea to write your own cryptography or markdown processor, but why do you need a library to left pad a string with zeroes? if statements and flags take time to process. You only have one way you need to do something. Do you want to take that much more compute just checking flags that will never change so you can get the library function to do what you always want it to do?
- Ygg2 4y agoSure, but there are many ways to make wheels, are your wheels 1.8m or 2m apart, what material, etc.? You may pass it off as a lark but stuff like this matters - to city builders, chariot makers, train track designers, and so on. You can go full NIH and reinvent the stone and finish about twelve years post end of universe or you can standardize and say ok, lets reuse some code. And if everyone reuses same code you can get into problems - common vulnerabilities.
- shafyy 4y agoThere's a fine line between NIH (not invented here) syndrom and overusing third party libraries. The classic example being the is-even[0] npm library, which seems like a joke, but has ~200k weekly downloads. It just seems that many devs too quickly reach for a third party library before taking a few minutes to think if it would make more sense or not to write the code themselves. 0: https://www.npmjs.com/package/is-even https://www.npmjs.com/package/is-even
- pluijzer 4y agoThe best thing is; this library depends on another library ... is-odd =D
- recursive 4y ago> too quickly reach for a third party library before taking a few minutes to think The funny thing is, npm install, and then import, and then calling it surely takes more time than just writing out the full implementation inline.
- frou_dh 4y agoDoes anyone here actually use Python? Because "not [using] some 3rd party library to write a command line interface for your python code" should mean: Use the argparse module that's in the Standard Library. Not coming up with something homegrown.
- aiisjustanif 4y agoI was wondering the same thing, there is very little reason to outside of the standard library in Python. Then you have the 3rd party the ones that have been solidified as basically standard as well. You shouldn’t be downloading a package from Joe Schmoe.
- morelisp 4y agoargparse? Surely you mean optparse? Or getopt? Standard libraries too will pass.
- fragmede 4y agoor docopt. or Click. Just as long as I don't have to code up handling short vs long options by hand more than once ever.
- pjc50 4y agoThat's what I was wondering. I find argparse so helpful that I use it everywhere I need to handle a command line. It works fine.
- zppln 4y agoIn Python you can insist on pulling in Click... or just use argparse which is available in the standard library.
- ekianjo 4y agoI assume you missed the fact that you can already do a lot with the standard library in Python for example.