Greg wrote:As time goes by, I more and more strongly feel I ought to learn Python.
I recently decided to try C because that's what the "experiments" that came with my Raspberry Pi starter kit have code for. Of course, they also have the Python code.
Why is Python better than C or C better than Python?
ETA: putting on my seldom used "take an interest in others" hat, Gee, Greg. Tell us about what has motivated this desire?
ETA2: That sounds sarcastic, but the sarcasm is directed at me, not you.
C is a much lower level language, what you control with C is much closer to what the computer is actually doing.
So what you can do with 1 or 2 lines of Python code, you might need hundreds of lines of C code to do. The upside, for C, is that those hundreds of lines of C code are almost certainly going to be faster (possibly MUCH faster) than the 1 or 2 lines of Python.
That's the short version.
When computers were less powerful, everything was written in lower level languages, like C. Or even lower, like assembler, for when you REALLY need speed and efficiency.
Now that computers are so much more powerful, higher level languages like Python are more desirable. They make it much easier to get any particular thing coded and done, and they run fast enough. Mostly. This is very desirable for folks like sysadmins, who want to automate various things.
Operating system kernels and such, device drivers, things that work with hardware and need to be *fast* still tend to all be written in things like C. Or just programs intended to run on very small, weak, slow computers.
A systems programmer (someone working on the OS or its utilities, network infrastructure, etc) will still need C, or relatives.
A sysadmin or regular person can get by with a scripting language, of which Python is the leading candidate these days. (Used to be Perl, and before that shell. Those are still used. I can get by in either of those.)
As a sysadmin, evolving to keep up with the world as it currently is, knowing Python is *very* helpful. Many scripts you'll run into are written in it, many of the newer cooler tools use it, or at least integrate with it.
Oh I should add, around 1991 (or 2? 3? I forget exactly) or so when it was clear that engineering wasn't happening, a friend gave me a copy of THE book on C (K&R) and said, 'need a job, learn this'. I did in fact work through the entire book and learn a bit of C, but found it exquisitely painful. So painful in fact, I got a job selling books (many of them copies of K&R) instead of coding C, for 1/4 the money of a coding job. Then my inherent geeky problem solving skills set me on the path to accidental sysadminhood.
Anyway, short version of *that* is, unless you know you need to know C, I recommend learning Python instead.
Maybe we're just jaded, but your villainy is not particularly impressive. -Ennesby
If you know what you're doing, you're not learning anything. -Unknown
Sanity is the process by which you continually adjust your beliefs so they are predictively sound. -esr