Abstract and concrete syntax

George Sakkis gsakkis at rutgers.edu
Thu Jun 9 01:59:29 EDT 2005


"Greg Ewing" wrote:

> > More generally, I think there is no abstract distinction between
> > statements and expressions.  Everything is an expression, can be evaluated
> > to a value.
>
> That's true in a functional language, but Python is not a
> functional language. In imperative programming, often you just
> do something for its side effect, and there's no obvious value
> to return. Forcing everything to return a value just for the
> sake of conceptual purity is an artificiality, in my view.

Well, I guess what makes an artificiality is subjective then, because
IMO the distinction between expressions and statements is a bigger
artificiality. Python already uses a default value (None) to return
from a callable, so what makes statements special ? Certainly not the
side effects, as the two equivalent ways to set an attribute show:
a.x = val            # statement
setattr(a,'x',val)   # expression 

George




More information about the Python-list mailing list