Okay, finally something that can be reasonably debated!
So what you’re saying is that you prefer x if x is not None else y
over x ?? y
. That’s perfectly reasonable, but I disagree, partly because THAT much verbosity is extremely annoying, and partly because it forces you to write x
twice - not a big deal if it’s a simple variable lookup, but it does make it harder to use when the left side is a function call or something.
Maybe, but I have seldom seen a programmer have trouble with extending that to x ** y
, which I don’t recall learning in primary school (exponentiation was done with superscripts, but never a double asterisk), and even multiplication and division aren’t spelled the way I learned them in my youth (x * y
vs x × y
or simply xy
). The “modulo” or “remainder” operator in programming, which varies in meaning from language to language, doesn’t really even exist in mathematics - but it’s not a problem to have x % y
with an operator.
So I suspect the “familiarity” argument is far less about grade-school mathematics (which really only covers addition and subtraction), and more about what we’re accustomed to from other programming languages.
I’m not sure there’s as much difference as you might think. Simple features are pretty easy to use (“Python as a calculator” is a great tool - just fire up the REPL and type expressions to be evaluated, no programming knowledge needed), but to be able to read and write arbitrary Python code, you still need to be at least broadly familiar with a good number of concepts. The barrier-to-entry is notably higher in C (though I wouldn’t say it’s all that much higher in JS), but the upper reaches of the language are going to still need some programming skill. For instance, I wouldn’t expect a non-programmer to understand this:
await asyncio.gather(*[cancel_task(t) for t in tasks])
A None-coalescing operator wouldn’t be something that you need for Python-as-a-calculator, and it’s far FAR less to get your head around than all the concepts of async/await (and asynchronicity in general).
I would reword the strength you’re describing. Rather than being “one doesn’t have to be an IT professional to read and write Python”, I would say, instead, that “a non-programmer can become a Python programmer in less time” (than, say, a C programmer). If you take someone who isn’t a programmer (say, a research scientist) and invite him/her to learn some Python in order to be able to better analyze the raw data, how much time would that take? How many days of research get sacrificed to the initial learning process, in order to get this benefit?
Obviously it’s impossible to put a simple figure on this, as it depends on the person’s background and the level of code complexity needed, but I would say that Python still has a quite considerable advantage here - partly because of the immense expressiveness of the language. We are not restricted to just what we can intuitively understand from grade school; operators like matrix multiplication are utterly meaningless to someone who’s just finished fourth-grade arithmetic, but are incredibly useful to a scientist who expresses concepts in matrices because it’s the most natural form for them.
We have a symbol for matrix multiplication because it is useful, not because it is pre-known by every single potential programmer. A None-coalescing operator isn’t taught in grade school, but that doesn’t mean it’s not useful.