You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
25 lines
468 B
Python
25 lines
468 B
Python
# From decompyle
|
|
# In Python 2.2 we don't have op LIST_APPEND while in > 2.3 we do.
|
|
|
|
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(), gen.next(), gen.next(), gen.next()
|