forked from RustPython/RustPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdismod.py
More file actions
44 lines (39 loc) · 759 Bytes
/
dismod.py
File metadata and controls
44 lines (39 loc) · 759 Bytes
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
import dis
dis.dis(compile("5 + x + 5 or 2", "", "eval"))
print("\n")
dis.dis(compile("""
def f(x):
return 1
""", "", "exec"))
print("\n")
dis.dis(compile("""
if a:
1 or 2
elif x == 'hello':
3
else:
4
""", "", "exec"))
print("\n")
dis.dis(compile("f(x=1, y=2)", "", "eval"))
print("\n")
def f():
with g(): # noqa: F821
try:
for a in {1: 4, 2: 5}:
yield [True and False or True, []]
except Exception:
raise not ValueError({1 for i in [1,2,3]})
dis.dis(f)
class A(object):
def f():
x += 1 # noqa: F821
pass
def g():
for i in range(5):
if i:
continue
else:
break
print("A.f\n")
dis.dis(A.f)