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

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Fri Aug 7 16:40:37 EDT 2020


On 2020-08-07 at 13:43:06 -0500,
Wyatt Biggs <wyatt.biggs at gmail.com> wrote:

> > It's also probably significantly slower, so you'd likely still want to
> > use the iterative version
> 
> Generalizing this to the majority of recursive functions/methods, are
> their iterative counterparts more efficient? (I say "majority of"
> because I've personally encountered one or two recursive
> functions/methods that were either very difficult for me to translate
> to iteration or just not possible with my skill level at the time)

As usual, it depends.  :-)

Often, a recursive algorithn in the *source* code is rewritten/optimized
by a compiler into an iterative algorithm in the *object* code.  And
sometimes, iterative code is rewritten into straight line imperative
code (i.e., loop unrolling, constant folding, etc.).  At runtime, that
stack of pending items has to be somewhere, and the hardware stack
(where the CPU-level return addresses are stored) can be as good a place
as any, which means that the recursive version *might* be as fast or
faster than the iterative version, under certain circunstances.

> For just a moment, allow me to abstract this argument to include
> languages other than Lisp I'm better versed in. Older languages, like
> Java and C, required explicit typing for their variables, explicit
> output types for their methods, and semicolons and brackets instead of
> utilized whitespace.  Please correct me if I'm wrong, but this system
> was primarily for saving memory because computers were far less
> powerful when these languages were born. Python, being a relatively
> young language, is free from these shackles and was built to run on
> more modern computers where bits and bytes are not a common
> constraint.

Lisp is older than both C and Java (by decades), and there's still no
explicit typing for variables.  In Lisp, the data has a type, and the
"variables" are just names for it (just like Python, or rather Python is
just like Lisp).

> That said, if I were to ever design a software I planned on sharing, I
> would write it in one of the more space-friendly languages.

Space-friendly?


More information about the Python-list mailing list