On 2020-08-07 at 04:00:34 +1000, Regarding "Re: How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?," Chris Angelico <ros...@gmail.com> wrote:
> On Fri, Aug 7, 2020 at 2:36 AM Christian Seberino <cseber...@gmail.com> wrote: > > > > On Thursday, August 6, 2020 at 10:52:00 AM UTC-5, Chris Angelico wrote: > > > The point of learning a > > > language isn't that you can take a piece of pre-existing code and > > > figure out what it'll do, step by step; the point is to be able to > > > encode your intentions in that language, and to read the code and > > > understand the other programmer's intentions. > > > > Thanks for sharing your thoughts. How do you define "expressiveness"? > > Also, why is Python syntax able to more clearly communicate intentions? > > Both Python and Lisp have comments so that isn't it. > > > > Expressiveness is about how well you can translate your ideas into > code, and how well someone else can interpret your ideas by reading > your code. It's hard to quantify, but it's in a way the most important > thing about any language. I would say that expressiveness is how *directly* you can translate your ideas into code, and how *directly* some one else can see your original idea by reading your code. So when I say something like "create a new list in which each value is double the value in the current list," that translates to relatively idiomatic Python like so: new_list = [] for value in current_list: new_list.append(2 * value) # or maybe value + value; YMMV Or even: [ 2 * value for value in current_list ] In Lisp, it might look like this: (mapcar #'(lambda (value) (* 2 value)) current_list) Unless you're familiar with Lisp (or Lisp-like languages), and comfortable with high order functions (which many/most beginners aren't, although most Lispers are), it's a lot harder to see the idea in the code. Having written my share of both Python and Lisp, I appreciate the benefits of Lisp's syntax, but I also know that it still takes me a little longer to read and understand a big block of straightforward Lisp vs. a big block of straightforward Python. (Between dunders, properties, and other bits of magic that takes place far away from its invocation, Python code and the logic behind it can be *very* confusing to unravel. Lisp macros present the same problem.) -- https://mail.python.org/mailman/listinfo/python-list