[Python-ideas] Statements vs Expressions... why?

Adam Olsen rhamph at gmail.com
Thu Sep 11 23:53:07 CEST 2008


On Thu, Sep 11, 2008 at 3:06 PM, Cliff Wells <cliff at develix.com> wrote:
> Also,
> go_make_some_side_effects() is probably ill-advised, and not something
> usually done in an FP style which you claim to be familiar with.
> Imperative programming is all about side-effects whereas functional
> programming is all about avoiding them.

This isn't true when applied to python.  We're about halfway in
between, regularly avoiding side effects (immutable int/str, sorted(),
iteration is generic and only covers reading), while happily doing
side-effects when appropriate.

Moreover, although iteration is built on mutation (the iterator
object's state changes as you go through it), good style is to contain
that in a single function.  The end result is often directly
translatable into a side-effect-free language, only our version is
easier to read; all they offer is a guarantee of no side effects.


-- 
Adam Olsen, aka Rhamphoryncus



More information about the Python-ideas mailing list