[Python-Dev] RE: code blocks using 'for' loops and generators
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Mar 17 02:47:28 CET 2005
Jim Jewett wrote:
> (2) A function as a parameter isn't good enough, because the
> passed-in function can't see bindings in the surrounding larger
> function. (It still sees the lexical scope it which it was defined.)
That sounds confused, because the lexical scope it which
it was defined is exactly what it *should* see.
> (4) A thunk could be used today be creating a string (rather than
> a pre-compiled function) and substituting in the thunk's string
Again, you seem to be under a misapprehension about how
code blocks should work. They should be lexically scoped,
not dynamically scoped.
> (7) A __leave__ or __exit__ special method really turns into another
> name for __del__.
Not really. A PEP-310-style __exit__ method is explicitly
invoked at well-defined times, not left until the object
is reclaimed. It doesn't suffer from any of the problems
of __del__.
--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg.ewing at canterbury.ac.nz +--------------------------------------+
More information about the Python-Dev
mailing list