[Python-Dev] thunks (was: code blocks using 'for' loops and
sabbey at u.washington.edu
Thu Mar 17 01:41:52 CET 2005
Jim Jewett wrote:
> It may be time to PEP (or re-PEP), if only to clarify what people are
> actually asking for.
I will PEPify this, unless someone does not think I am the correct person
to do so. The PEP is probably a better place to try to address questions
you raise, as well as give the rationale that Josiah Carlson was looking
But, in short:
> Brian Sabbey's example from message
> *seems* reasonably clear, but I don't see how it relates in any way to
> "for" loops or generators, except as one (but not the only) use case.
The original post in this thread was an idea about using 'for' loops and
generators, but that idea has since been replaced with something else.
> (1) Calls for "Ruby blocks" or "thunks" are basically calls for
> placeholders in a function. These placeholders will be filled
> with code from someplace else, but will execute in the function's
> own local namespace.
It wasn't my intention that the thunk would execute in the function's
namespace ("function" here is to mean the function that takes the thunk as
an argument). I was thinking that scope rules for the thunk would mimic
the rules for control flow structures.
More information about the Python-Dev