On Fri, 7 Aug 2020 at 17:14, Christian Seberino <cseber...@gmail.com> wrote:
> This is an interesting observation.  I've heard people say the fact that
> Python has both expressions and statements is a negative.  (Lisp only
> has expressions.)

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, but an
assignment statement. 99% of times you simply wrong and wanted:

if (a == b)

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

Maybe Lisp does not separate expressions and statements because it
supports both functional and imperative programming, while Python is
mainly an imperative language with some functional features. Not sure
about this, since I never used any Lisp dialect and I've not yet used
function programming in the real world.

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.

@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.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to