Skip to content

Commit a0e3cb5

Browse files
committed
simplifies python example
1 parent 9fee8ae commit a0e3cb5

File tree

7 files changed

+12
-33
lines changed

7 files changed

+12
-33
lines changed

examples/python/__init__.py

Whitespace-only changes.

examples/python/a_module/__init__.py

Whitespace-only changes.

examples/python/a_module/foo.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/python/b_module/__init__.py

Whitespace-only changes.

examples/python/b_module/bar.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/python/main.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
import time
2-
import threading
3-
from a_module.foo import foo
4-
from b_module.bar import bar
1+
def work(n):
2+
i = 0
3+
while i < n:
4+
i += 1
55

6-
ITERATIONS = 251678
6+
def fast_function():
7+
work(20000)
78

8-
if __name__ == "__main__":
9-
10-
print(f'yoyoy Application 1 started')
11-
for i in range(ITERATIONS):
12-
foo(75000)
13-
bar(25000)
14-
print(f'yoyoy Application 1 ended')
9+
def slow_function():
10+
work(80000)
1511

16-
print(f'Switching fast and slow around.....')
17-
time.sleep(20)
18-
print(f'Switching fast and slow around.....')
19-
20-
print(f'yoyoy Application 2 started')
21-
for i in range(ITERATIONS):
22-
bar(25000)
23-
foo(8000)
24-
print(f'yoyoy Application 2 ended')
12+
if __name__ == "__main__":
13+
while True:
14+
fast_function()
15+
slow_function()

examples/python/util.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)