Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c55e7c

Browse files
committed
Better error messages
1 parent 0ed0cae commit 3c55e7c

File tree

5 files changed

+13
-170
lines changed

5 files changed

+13
-170
lines changed

code/ch02-error-messages/better_messages.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def main():
2121
"country": {
2222
"size": {
2323
"area": 1_000_000,
24-
"units": "miles ",
24+
"units": "miles",
2525
}
2626
}
2727
}
@@ -34,24 +34,28 @@ def main():
3434

3535
print(func1(data, b, c, d, e))
3636

37-
# d = "other"
37+
# d = "bigness"
3838
# print(func1(data, b, c, d, e))
3939

4040
t1 = Thing("Bob", 70, 24)
4141
t2 = Thing("Sarah", 65, 32)
4242
t3 = Thing("Jake", 72, 20)
4343

44-
total = func2(t1, t2, t3)
45-
print(f'The total weight is {total:,}.')
44+
total_weight = func2(t1, t2, t3)
45+
print(f'The total weight is {total_weight} kg')
4646

4747
# t2 = None
48-
# total = func2(t1, t2, t3)
49-
# print(f'The total weight is {total:,}.')
48+
# total_weight = func2(t1, t2, t3)
49+
# print(f'The total weight is {total_weight} kg')
5050

51-
# print(t1.weight + t4.weight)
52-
# NameError: name 't4' is not defined. Did you mean: 't1'?
51+
print(func3(1, 2, 3, 4))
52+
# print(func3(1, 2, "3", 4))
53+
54+
sarah = t2
55+
bob = t1
56+
57+
# print(f"The weight of bob and sarah is {bob.weight} & {sara.weight}")
5358

54-
# print(f'Sum is {func3(1, 2, "3", 4)}')
5559

5660

5761
if __name__ == '__main__':

code/ch02-error-messages/notes.py

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

code/ch03-concurrency/groups.py

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

requirements.in

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

requirements.txt

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

0 commit comments

Comments
 (0)