3 ms·
Neither is readable because both are filled with magic numbers. With experience the Lisp becomes more readable when formatted conventionally: (setv result (-
by brudgers 9y ago
Neither is readable because both are filled with magic numbers. With experience the Lisp becomes more readable when formatted conventionally:
(setv result (- (/ (+ 1 3 88)
2)
8))
Line breaking the Python is possible but unconventional and requires additional symbols.
As expressions become more complex, languages with infix operators are faced with the choice between some form of operator precedence and strict left to right (or right to left) application. It is hard to look at:
6 * 89 & 57 >> 2**2 - 1
and see the implicit parenthesis. And maybe not having to figure out where the implicit parentheses go in complex cases is part of the attraction of Lisp syntax. Lisp code does not require going to the rule book as often.
- mythrwy 9y agoOnce you are in the parentheses line breaks in python are just fine, no additional symbols needed. result = ((( 1 + 3 + 8) / 2) * 6) works. Also works as a way to deal with long strings without the \. long_string = ('hello' 'really' ' really' ' long' ' line' )
- brudgers 9y agoLine breaks in Python are generally unconventional. For what it is worth, the PEP 8 recommendation is for the operator to begin the line (Knuth style), i.e. result = ((( 1 + 3 + 8) / 2) * 6) How much that looks like Lisp is a matter of opinion I suppose.