lambda closure question

Diez B. Roggisch deetsNOSPAM at web.de
Mon Feb 21 08:02:48 EST 2005


> But I'll get back at what seems you actually wanted to say:
> That there is no way to rebind 'x' or in my case 'l' and
> with that I have to agree although I personnaly find that
> a lack in python

It's not only that way in python, but in java too. So it seems that there is
a fundamental principle behind it: In a language that allows sideeffects,
these will actually happen.

If you're after side-effect free programming, I recommend using a functional
programming language like ocaml or haskell. In these, you can't mutate
objects at all, only recreate them and rebind them to new variables. This
prevents whole classes of errors - but of course it also introduces all
kinds of other constraints on your programming style, e.g. using monads and
so on.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list