Greg Ewing wrote: >>it would be >>equivalent as if every "val = g2.next()" in g1 was rewritten: >> >> val = g2.next() >> if isinstance(val, magic.Cooperate): >> yield val > > > Something bothers me about that proposal, and I think it's this: it > would mean that generators are no longer simply a particular technique > for implementing iterators, but would have special powers that other > iterators don't have. Unless recognising the magic Cooperate value and > doing the right thing were made part of the iterator protocol, and all > iterators were expected to do the right thing with it, which would be > a big imposition. > I agree with Greg and the other comments on wanting to keep generators simple. Part of the beauty of generators is the are brain-dead simple to use while still being handy as hell. Playing with them to add the ability to play asynchronous stuff doesn't seem right. I would rather see full-blown coroutines for Python 3000 to deal with this somehow. -Brett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4