Python handles globals badly.

random832 at fastmail.us random832 at fastmail.us
Thu Sep 10 16:30:20 EDT 2015


On Thu, Sep 10, 2015, at 14:13, Steven D'Aprano wrote:
> Because that's the definition of an expression in this context. An
> expression is evaluated to either return a result, or raise an exception.

Nonsense. An expression is something allowed within a larger expression.
It's easy to imagine an expression allowing a subexpression that does
not return a result. For example, in non-tail positions of something
like C-comma/Lisp-progn.

Or, for example, if a C-style "for" loop was an expression, the
initializer and increment bits.

This is semantics, to some extent - you could just as well say an
expression may "return" a "result" that is a special non-value which
transforms into an error if it's allowed to escape into a context where
the value is needed (e.g. the argument to a function, a place a boolean
is expected, being assigned to a variable) - C (and other C-family
languages) has such a thing, Lisp does not.



More information about the Python-list mailing list