Some language proposals.
Jacek Generowicz
jacek.generowicz at cern.ch
Wed Feb 25 06:43:04 EST 2004
Paul Prescod <paul at prescod.net> writes:
> Jacek Generowicz wrote:
>
> > Could somebody point me to an explanation of why closures are broken
> > in this way in the first place, please ?
>
> a = 5
> def b():
> a = 6
> def c():
> a = 7
> print a
> print a
> c()
>
> print b()()
Methinks you forgot to return something somewhere.
> Python uses a single syntax for declarating a variable and assigning
> to it.
Ah, thank you, _this_ is the salient point ( ... though I'm not sure
what "declarating" means, but I'm pretty sure that Python does not do
it to variables :-).
But what happens in other languages which support closures, but have
no syntactic distinction between binding and re-binding ?
> This causes a problem for Lisp purists but is otherwise helpful.
Lisp causes problems for the simple-minded, but is otherwise helpful.
(Infer as many winks/smileys as you implied in your original.)
More information about the Python-list
mailing list