Suggesting a new feature - "Inverse Generators"

Jordan Rastrick jrastrick at
Fri Mar 25 17:49:33 CET 2005

Yes, granted.

This is basically the same as Andrew's reply, except with Iterators in
place of generators, so I'll let my answer to that stand. In fact, its
my solution, but with in place of accept :)

This is probably something like how I wanted to solve the problem when
I first was looking at it and wanting a generator based solution. I
ended up thinking of this whole Acceptor business as part of getting me
to this point.

I'll try to reduce my pages of ranting to a single question. In
posting, i was wondering if the "syntactic sugar" (Acceptors) that i
invented to implement the solution is of any general interest. So are
there maybe examples less straightforward than this one, where
Acceptors work better? Or can you always just "turn the generator
inside out" in the way you have done here?

If you can always do it your way, well, thats a powerful design
pattern, and it just goes to show my faith in Generators was justified
:) And that I wasnt thinking hard /clearly enough about how to use

There are other issues, like "Does the Acceptor syntax, although
perhaps functionally equivalent to other methods, ever make the code
more readable, easier to parse, etc?" But they're a lot less important
i'd say.

More information about the Python-list mailing list