You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
first commit
This commit is contained in:
22
test/test_yield.py
Executable file
22
test/test_yield.py
Executable file
@@ -0,0 +1,22 @@
|
||||
from __future__ import generators
|
||||
|
||||
def inorder(t):
|
||||
if t:
|
||||
for x in inorder(t.left):
|
||||
yield x
|
||||
yield t.label
|
||||
for x in inorder(t.right):
|
||||
yield x
|
||||
|
||||
def generate_ints(n):
|
||||
for i in range(n):
|
||||
yield i*2
|
||||
|
||||
for i in generate_ints(5):
|
||||
print i,
|
||||
print
|
||||
gen = generate_ints(3)
|
||||
print gen.next(),
|
||||
print gen.next(),
|
||||
print gen.next(),
|
||||
print gen.next()
|
Reference in New Issue
Block a user