Sign in
go
/
website
/
7a60f303d8c4f3c0c7daab7b2175a6ff4f692698
/
.
/
_content
/
talks
/
2013
/
go4python
/
fib-gen.py
blob: bc02cfdddea1292a81e699f91af43f881cd37683 [
file
] [
log
] [
blame
]
#!/usr/bin/python
def
fib
(
n
):
a
,
b
=
0
,
1
for
i
in
range
(
n
):
a
,
b
=
b
,
a
+
b
yield
a
f
=
fib
(
10
)
try
:
while
True
:
print
f
.
next
()
except
StopIteration
:
print
'done'
for
x
in
fib
(
10
):
print
x
print
'done'