FW: FW: [Python-Dev] Simple generator implementation

Tim Peters tim.one@home.com
Sun, 25 Mar 2001 03:07:09 -0500


[Tim]
>> The correspondent I quoted believed the latter ["simple" generators]
>> were on-target for XSLT work ... But ... I don't know whether they're
>> sufficient for what you have in mind.

[Uche Ogbuji]
> Based on a discussion with Christian at IPC9, they are.  I should
> have been more clear about that.  My main need is to be able to change
> a bit of context and invoke a different execution path, without going
> through the full overhead of a function call.  XSLT, if written
> naturally", tends to involve huge numbers of such tweak-context-and-
> branch operations.
> ...
> Suspending only to the invoker should do the trick because it is
> typically a single XSLT instruction that governs multiple tree-
> operations with varied context.

Thank you for explaining more!  It's helpful.

> At IPC9, Guido put up a poll of likely use of stackless features,
> and it was a pretty clear arithmetic progression from those who
> wanted to use microthreads, to those who wanted co-routines, to
> those who wanted just generators.  The generator folks were
> probably 2/3 of the assembly.  Looks as if many have decided,
> and they seem to agree with you.

They can't:  I haven't taken a position <0.5 wink>.  As I said, I'm trying to
get closer to understanding the cost/benefit tradeoffs here.

I've been nagging in favor of simple generators for a decade now, and every
time I've tried they've gotten hijacked by some grander scheme with much
muddier tradeoffs.  That's been very frustrating, since I've had good uses
for simple generators darned near every day of my Python life, and "the only
thing stopping them" has been a morbid fascination with Scheme's mistakes
<wink>.  That phase appears to be over, and *now* "the only thing stopping
them" appears to be a healthy fascination with coroutines and uthreads.
That's cool, although this is definitely a "the perfect is the enemy of the
good" kind of thing.

trying-leave-a-better-world-for-the-children<wink>-ly y'rs  - tim