How explain why Python is easier/nicer than Lisp which has a simpler grammar/syntax?

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Thu Aug 6 16:07:55 EDT 2020


On 2020-08-07 at 05:22:53 +1000,
Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Aug 7, 2020 at 5:10 AM <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:

> One thing worth noting is that your mental pseudo-code is affected by
> the languages you're comfortable with. You said:
> 
> > create a new list in which each value is double the value in the current list
> 
> which clearly and obviously translates into a list comprehension. But
> what if you instead thought of it as:
> 
> > double every value in this list
> 
> ? That would translate far more obviously into an imperative construct
> that doesn't really work in Python ...

    for (index, value) in enumerate(this_list):
        this_list[index] = 2 * value

Or:

    for index in range(len(this_list)):
        this_list[index] *= 2

(But I tend to avoid that, though, because I can never remember exactly
which mutations work inside a loop and which ones don't (or does
enumerate remove some or all of those restrictions?).  Which feeds right
into what you said about being comfortable with certain languages or
programming styles.)

[Shared] Mutable Data will be the death of us all!  ;-)

> So the expressiveness of a language isn't a fixed quantity, but it
> depends on the programmer. And it can change as you learn and adjust,
> too.

I think the expressiveness of the language remains fairly constant, new
features notwithstanding.  Unless you mean that a given programmer's
usage of that expressiveness changes, in which case I absolutely agree.


More information about the Python-list mailing list