Skip to content

Commit f86aee2

Browse files
committed
updated from Atlas
1 parent f4cdee2 commit f86aee2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+587
-333
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
YKCOWREBBAJ
1616
>>> what # <4>
1717
'JABBERWOCKY'
18+
>>> print('Back to normal.') # <5>
19+
Back to normal.
1820
1921
# END MIRROR_DEMO_1
2022
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# BEGIN CORO_AVERAGER
21
"""
32
A coroutine to compute a running average
43
4+
# BEGIN CORO_AVERAGER_TEST
55
>>> coro_avg = averager() # <1>
66
>>> next(coro_avg) # <2>
77
>>> coro_avg.send(10) # <3>
@@ -11,14 +11,17 @@
1111
>>> coro_avg.send(5)
1212
15.0
1313
14+
# END CORO_AVERAGER_TEST
15+
1416
"""
1517

18+
# BEGIN CORO_AVERAGER
1619
def averager():
1720
total = 0.0
1821
count = 0
1922
average = None
20-
while True:
21-
term = yield average # <4>
23+
while True: # <1>
24+
term = yield average # <2>
2225
total += term
2326
count += 1
2427
average = total/count
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# BEGIN RETURNING_AVERAGER_DEMO1
77
88
>>> coro_avg = averager()
9-
>>> next(coro_avg) # <1>
10-
>>> coro_avg.send(10)
9+
>>> next(coro_avg)
10+
>>> coro_avg.send(10) # <1>
1111
>>> coro_avg.send(30)
1212
>>> coro_avg.send(6.5)
1313
>>> coro_avg.send(None) # <2>
@@ -58,4 +58,4 @@ def averager():
5858
count += 1
5959
average = total/count
6060
return Result(count, average) # <2>
61-
# END RETURNING_AVERAGER
61+
# END RETURNING_AVERAGER
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def main(data): # <8>
7575
next(group) # <10>
7676
for value in values:
7777
group.send(value) # <11>
78-
group.send(None) # <12>
78+
group.send(None) # important! <12>
7979

8080
# print(results) # uncomment to debug
8181
report(results)

0 commit comments

Comments
 (0)