Generator question
Timothy Wu
2huggie at gmail.com
Sun Nov 26 04:17:51 EST 2006
Hi,
Using generator recursively is not doing what I expect:
def test_gen(x):
yield x
x = x - 1
if x != 0:
test_gen(x)
for item in test_gen(3):
print item
This gives me a single number 3 and not printing 2 and 1 as I would expect.
What is wrong??
Timothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061126/a05e839a/attachment.html>
More information about the Python-list
mailing list