Greg Ewing wrote: > Something is bothering me about this. In fact, > it's bothering me a LOT. In the following, will > f() work as a generator-function: > > def f(): > for i in range(5): > g(i) > > def g(i): > for j in range(10): > yield i,j > > If I understand PEP255 correctly, this will *not* > work. No, it will not work. The title of PEP 255 is "Simple Generators". What you want will require something like stackless in order to get the C stack out of the way. That's a major change to the Python internals. To make your example work you need to do: def f(): for i in range(5): for j in g(i): yield j def g(i): for j in range(10): yield i,j Stackless may still be in Python's future but no for 2.2. Neil
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