2013-12-29 17:34:42 -05:00
|
|
|
def f(x):
|
|
|
|
print('a')
|
|
|
|
y = x
|
|
|
|
print('b')
|
|
|
|
while y > 0:
|
|
|
|
print('c')
|
|
|
|
y -= 1
|
|
|
|
print('d')
|
|
|
|
yield y
|
|
|
|
print('e')
|
|
|
|
print('f')
|
|
|
|
return None
|
|
|
|
|
|
|
|
for val in f(3):
|
|
|
|
print(val)
|
|
|
|
|
|
|
|
#gen = f(3)
|
|
|
|
#print(gen)
|
|
|
|
#print(gen.__next__())
|
|
|
|
#print(gen.__next__())
|
|
|
|
#print(gen.__next__())
|
|
|
|
#print(gen.__next__())
|
2016-12-19 20:57:39 -05:00
|
|
|
|
|
|
|
# test printing, but only the first chars that match CPython
|
|
|
|
print(repr(f(0))[0:17])
|