-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
48 lines (38 loc) · 1.27 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from functools import partial
import timeit
from cymath import fab_cpdef, fab_defcallcdef, fab_purepy, fab_defcallimpl, pyprint
default_number = 10000000
# print(f"纯py {timeit.timeit('fab(20)', number=default_number, globals=globals())}")
# print(f"cpdef {timeit.timeit('fab_cpdef(20)', number=default_number, globals=globals())}")
# print(f"defcallcdef {timeit.timeit('fab_defcallcdef(20)', number=default_number, globals=globals())}")
# # print(f"purepy {timeit.timeit('fab_purepy(20)', number=default_number, globals=globals())}")
# print(f"purec {timeit.timeit('fab_defcallimpl(20)', number=default_number, globals=globals())}")
from cymath import test
class Context:
def __init__(self):
self.closed = False
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
print("close")
self.closed = True
#
# def test():
# con = Context()
# try:
# print("要返回了",con.closed)
# return con
# finally:
# con.closed = True
#
#
# def main():
# con = test()
# print("调用返回了")
# print(con.closed)
list(range(20))
data = bytes(list(range(20)))
print(data)
pyprint(data)
# print(data)
# test.print_bytes(data, len(data))