wrapping yield ?

Michael Sparks Michael.Sparks at rd.bbc.co.uk
Fri Sep 13 12:55:09 CEST 2002

"Duncan Booth" <duncan at NOSPAMrcp.co.uk> wrote in message
news:Xns9288759449799duncanrcpcouk at
> The syntax wouldn't look quite so bad if your function wasn't returning a
> value.

Problem is, it would in most situations, also I'm trying to keep the number
of generators to a minimum whilst a lower overhead than things like threads
and processes if I had several 10s of thousands going, keeping throughput
up may become an issue. (Hence the reason for wanting the functions called
part of the same generator rather than a separate, extra one)

> There definitely isn't any way to put a yield in a function and not have
> turn into a generator. When you yield from a generator, only a single
> is saved, not a stack, so you can only yield from the outer loop.

Ah... that makes sense then...Pity - after all, "all you'd need" (looking at
simplistically) is a marker in the stack frame to tell the system how much
of the
stack to save. Amiga E had something very similar (from a use perspective)
determining how far back to throw exceptions without requiring the
of try/(except|catch) blocks.



More information about the Python-list mailing list