(Jokes aside, it would really be more complicated in C if a and b were actually strings or lists.)
There's a surprising amount of depth to adding two numbers.
You don't event need strings or lists for that. Just imagine bigger numbers for a and b. Arbitrarily long integer addition is not a native language feature in C.
edit: formatting
fac = lambda n: 1 if n<=1 else n*fac(n-1)
a, b = fac(42), fac(69)
a + b
is 3 lines of python; how many lines of C code would it take to execute?Joking aside: these are not catch-all comparisons. Nor is the article. But Python is mucher slower and much safer than C. It's easier to start in Python than in C.
return 0;
in the hopes that compiles down to something like: xor rax, rax
ret#! /Usr/bin/python
Print(a+b)
V
#include <stdio.h>
Int main (){ Printf("%i", a+b); Return 0; }
And printf is basically a DSL, so it still isn't 'simple' And this is assuming a+b fits into an integer
$ cat tmp.c
main() {
printf("%d\n", 3+4);
}
$ gcc -w -o tmp.out tmp.c && ./tmp.out
7
You can even do away with types entirely, as long as you're working with ints: $ cat tmp.c
foo(x) {
return x+5;
}
bar() {
return 4;
}
main() {
printf("%d\n", foo(bar()));
}
$ gcc -w -o tmp.out tmp.c && ./tmp.out
9
Rarely a good idea, though!Anyway, my main point was that c has more boilerplate. It's never 'a+b'.
Second, printf is complicated, that's aimed more at the op though.
How much more, though? The conventional wisdom here seems to be that it's worth taking the unavoidable performance hit of dynamically typed scripting languages because the productivity boost to programmers balances it out... but I don't believe I've seen that productivity boost measured. Once you know what you're doing in C, you can do that same things you can do in Python. There's some (fascinating) syntactic sugar in there, but Python can easily be just as incomprehensible as C.
The whole point of high level languages is that you put in effort upfront to make everyone elses job easier.
By you logic, using machine code directly onto toggle switches is easiest. No assembler to write, no test editor to write.....