3 ms·
The best definition of simple I've found is "one that takes the least cognitive load to use/comprehend." With programming it's actually hugely complicated, bec
by urthor 5y ago
The best definition of simple I've found is "one that takes the least cognitive load to use/comprehend."
With programming it's actually hugely complicated, because are you trying to lower the mental effort to read, or the mental effort to write?
a + b is simple to write because it reminds you of high school mathematics.
However, I'd argue
from operator import add, mul
def square(x):
return mul(x, x)
def sum_squares(x, y):
return add(square(x), square(y))
result = sum_squares(5, 12)
Is an excellent way for newer programmers to read code, and learn what is happening.