Misunderstanding about closures
jacek.generowicz at cern.ch
Thu Jun 17 09:27:20 CEST 2004
Alexander Schmolck <a.schmolck at gmx.net> writes:
> This dredging up of former quotes is generally a bad thing to do, but I'll do
> it anyway in the hope to lay the whole thing to rest.
> > Alexander Schmolck <a.schmolck at gmx.net> writes:
> >> [in] scheme, the standard iteration construct 'do' does indeed introduce
> >> a *new binding* on each iteration.
> > Yes, but this is a consequence of Scheme faking iteration with
> > recursion.
> Not really.
What do you mean? (Forget the use of the word "faking".)
Iteration-based recursion introduces a new binding because each
iteration is a new function invocation with its concommittant binding
of local variables. _The same happens in Python_ if you make use of a
recursion-based iteration construct. That was the point of the post
under discussion; to show that the perceived differences beteween the
ways that closures work in Python and Scheme are a result of
differences in the recursion constructs used, rather than differences
in the way closures work.
> I also hope to have made it comprehensible why your post might be
> read in such a way and why readers of it might profit from
> additional clarifying information.
I agree that some people might profit from additional clarifying
I also think that most of the information you provided is OT in this
group ... and OT to the topic, which was about how _closures_ work in
_Python_, and not about the merits (or demertis) of Scheme iteration.
So, as you suggested, let's let it rest.
PS Re-reading my previous reply I see that I probably sounded to
agressive, defensive, whatever ... sorry.
More information about the Python-list