"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

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to