Question about "yield" and generator function support

16 views
Skip to first unread message

Bernard

unread,
Oct 26, 2009, 8:51:23 PM10/26/09
to tinypy
tinypy complains about "Exception: tp_mod(unknown "%s",yield)" while
running the following code but CPython runs successfully. Any ideas?


def fibonacci():
"""a generator for Fibonacci numbers, goes to next number in
series on each call"""
a, b = 0, 1
while True:
yield a
a, b = b, a + b

def main():
f = fibonacci()
for x in range(13):
print f.next(), # 0 1 1 2 3 5 8 13 21 34 55 89 144

if __name__ == '__main__':
main()

Dean Hall

unread,
Oct 27, 2009, 8:45:43 AM10/27/09
to tin...@googlegroups.com
A first guess is that the "yield" keyword is not supported. Grep the
code for "yield" or "generator" and see if you get a hit.

!!Dean
Reply all
Reply to author
Forward
0 new messages