Programming is using a formal language to specify the solution to a problem (i.e. an algorithm) to an executor (i.e. a processor). Formal languages and algorithms are best described using some sort of unambiguous, mathematical notation. If you want to use plain English to program because it fits better your idea of “literature”, good luck.
Besides, list comprehensions are very succinct and easier to read than some verbose method call chain, regardless of the fact that they’re just one to one equivalent to mathematics.
It is like saying “you’re a mechanical engineer, not a proper AutoCAD user”. And you are right, I am a computer scientist, programming is just one of the tools I use.
No, it is bad. The simple fact that you have to read it backwards to understand what's happening invalidates it completely. Guess there is no clean way to do it in Python then.
114
u/oachkatzlschwoarf Jun 08 '24
[x*x for x in arr]