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

Python python at bladeshadow.org
Fri Aug 7 11:36:15 EDT 2020


On Fri, Aug 07, 2020 at 04:23:42PM +1000, Chris Angelico wrote:
> On Fri, Aug 7, 2020 at 11:11 AM Python <python at bladeshadow.org> wrote:
> > Pretty straightforward.  Now try yourself to write the iterative
> > version.
> 
> It might look slightly better to a mathematician, but it's so
> abysmally inefficient (unless you add extra layers of indirection)
> that it's not really a good example.

Yes, I did say more or less that... but efficiency was not the point.
Understanding was the point.

> The iterative version seeds the algorithm and lets it run:

Sure Chris, I fully expected YOU to get this on the first try, but the
average programmer tends not to.  My team uses it as an interview
question fairly often, and I'd venture a guess that upward of 80% of
candidates get it wrong on their first try.   The recursive version
is typically much easier to understand intuitively, not just for
mathemeticians, because it more or less restates in simple,
straightforward code what the natural language definition of the
Fibonacci sequence is, rather efficiently (not efficiency of
execution, efficiency of converting natural language to code).

The iterative version requires a bit more thought to make sure you're
seeding the state poperly, and maintaining it properly as the loop
executes.  I'd imagine most folks who hang around in this forum would
consider that you are not an average programmer.

Your example was also a fine example.



More information about the Python-list mailing list