Python as a shell replacement
Python as a shell replacement
Posted Dec 7, 2019 23:22 UTC (Sat) by marcH (subscriber, #57642)In reply to: Creating Kubernetes distributions by epa
Parent article: Creating Kubernetes distributions
BTW C has similar error handling behaviors, most likely not a coincidence.
I repeat: any shell program longer than a few thousands lines or with some serious data structures is probably a mistake. This being out of the way, let me try to rephrase and clarify what I meant earlier:
1. Python-as-a-shell adds extra code and significant overhead; you can't start prototyping by just throwing your .bash_history into a file anymore.
2. Python has a built-in and pretty good exception system that you generally don't even have to think about.
So why did the migration overhead I paid in 1. didn't magically give me 2. for free? Why do I have to think so much about error handling when I use the subprocess module? In _short_ shell scripts good error handling is the only thing I was missing! So where did my migration money go?
The Python people are very smart, so I guess there must be good technical reasons for that, yet these excuses still don't make Python a desirable replacement for short shell scripts (unless you absolutely need to support Windows). Actually, I'm worried these justifications may not be Python specific and may preclude _any_ general purpose language as a shell replacement...
Insightful interview with Steve Bourne: https://www.arnnet.com.au/article/279011/a-z_programming_...
