lambda closure question

Antoon Pardon apardon at forel.vub.ac.be
Mon Feb 21 09:20:37 EST 2005


Op 2005-02-21, Diez B. Roggisch schreef <deetsNOSPAM at web.de>:
>> 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.
>

I have the impression that you misunderstood me. I'm not after a
side-effect free language. I just think python could be nicer in
allowing some side-effects.

-- 
Antoon Pardon



More information about the Python-list mailing list