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 12:19:33 EDT 2020


On 2020-08-07 at 17:55:45 +0200,
Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:

> On Fri, 7 Aug 2020 at 17:14, Christian Seberino <cseberino at gmail.com> wrote:

> Commonly, in imperative languages like C, you can write
> 
> if (a = b) {...}
> 
> This is allowed in C, even if a = b is not an expression ...

In C, a = b *is* an expression.  An assignment expression that uses the
assignment operator.  See
<https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B>.

> ... 99% of times you simply wrong and wanted:

> if (a == b)

Where did 99% come from?

> Python separates statements and expressions, so where you expect an
> expression, you can't write a statement.

Yes.

> Maybe Lisp does not separate expressions and statements because it
> supports both functional and imperative programming ...

It's not a matter of separating expressions from statements.  Lisp
doesn't have statements.  It only has expressions.  If you choose to
write imperative code in Lisp, all you're really doing is using the
expressions for their side effects rather than their values.

> PS: Recently there's an exception: if you *really* want an assignment
> when an expression is expected, you can use the "walrus" := operator.
> IMO it renders the code less readable and I'm not sure about it's
> usefulness.

It makes some code more concise.  Readability is in the eye of the
beholder.

> @Chris: note that "real" recursion in Python is not possible, since
> there's no support for tail recursion. Maybe something similar can be
> done using async functions.

Python has real recursion.  Whether or not there's tail recursion on the
inside is an implementation detail.


More information about the Python-list mailing list