[Neal D. Becker]
> ...
> Only one problem. Is there any way to access the state of a
> generator externally? In other words, the generator saves all it's
> local variables. Can an unrelated object then query the values of
> those variables? (In this case, to get at intermediate results)
It's
"Neal D. Becker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am converting optimization code from legacy C to python. Generators are
a
> HUGE convenience, because the original code structures have the optimizer
> as the main code calling your function, while I want to invert t
Neal D. Becker wrote:
> Only one problem. Is there any way to access the state of a generator
> externally? In other words, the generator saves all it's local variables.
> Can an unrelated object then query the values of those variables? (In
You get read access with generator.gi_frame.f_locals
Neal D. Becker wrote:
Only one problem. Is there any way to access the state of a generator
externally? In other words, the generator saves all it's local variables.
Can an unrelated object then query the values of those variables? (In this
case, to get at intermediate results)
You could make
I am converting optimization code from legacy C to python. Generators are a
HUGE convenience, because the original code structures have the optimizer
as the main code calling your function, while I want to invert these roles.
I want to call the optimizer to perform just one step at a time.
So, t