Skip to content

Commit 6bb6ca5

Browse files
committed
adding debug code
1 parent 1658a4b commit 6bb6ca5

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

chapter6/hello_debug.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def add(x,y):
2+
print(f"The value of x: {x}")
3+
print(f"The value of y: {y}")
4+
return x+y
5+
6+
result = add(3,7)
7+
print(result)

chapter6/hello_debug_object.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Z: pass
2+
zz = Z()
3+
4+
def add(x,y):
5+
print(f"The value of x: {x}")
6+
print(f"The value of y: {y}")
7+
return x+y
8+
9+
result = add(3,zz)
10+
print(result)

chapter6/hello_debug_object_pdb.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Z: pass
2+
zz = Z()
3+
4+
def add(x,y):
5+
import pdb;pdb.set_trace()
6+
print(f"The value of x: {x}")
7+
print(f"The value of y: {y}")
8+
return x+y
9+
10+
result = add(3,zz)
11+
print(result)

0 commit comments

Comments
 (0)