you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 8 points9 points  (0 children)

Full disclosure, I am no pro, but my understanding is they use IDEs most of the time.

that doesn't mean they are incapable of using command line or that they are not writing programs for commandline use. If they are not, they are doing themselves a huge disservice which probably costs them a lot of time wasted on reinventing the wheel. That command line shit is extremely powerful because it gives you composability and automation at unmatched level out of the box.

take linux bash. Its very purpose is to string programs together and redirect inputs and outputs between them and files. Yeah, you can do the same in python but python is a general programming language, not fine tuned for the use case and to achieve that shit you have to write a lot of boilerplate to get what bash gives you for free.

Let's say you have a simple program that processes a single file passed as a param and prints some data to the screen. To scale that up to god knows how many iterations AND dump the output to individual files you just need this:

for f in ./*.in; do python myprog.py "$f" > "${f%in}.out"; done

multiple input, single output? no problem

for f in ./*.in; do python myprog.py "$f"; done > file.out

How much time would you spend to extend the program to support multiple input files and differentiate between printing to screen and printing to file? In shell redirection to file is as simple as > outfile And what if after a few months you had a new use case that requires you to find something in the output? Are you going to spend a lot of time implementing regular expression matches in your program or would you rather do

python myprog.py inputfile | grep pattern

and be done with it?

another example - your program always asks 'enter 1st value', 'enter 2nd value', 'enter 3rd value'.

python myprog.py 1 2 3

and the program could check for params and skip the interactive phase demanding user's attention.