Skip to content

Commit c5bf79f

Browse files
committed
markdown source builds
Auto-generated via `{sandpaper}` Source : bd8c767 Branch : main Author : Andrew Gait <andrew.gait@manchester.ac.uk> Time : 2026-04-16 15:49:33 +0000 Message : Merge pull request #70 from UoMResearchIT/40-update-section-on-assert Add callout about assert and optimization
1 parent afada0f commit c5bf79f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

05-defensive_programming.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,15 @@ Traceback (most recent call last):
228228
AssertionError: Variable has to be a numerical object
229229
```
230230

231-
Like the earlier `if` statement, this catches the problematic variable before it reaches our calculation. However it is far less intrusive code, and assert tests can be added in sequence, so that we can quickly and easily increase the coverage of such tests.
231+
Like the earlier `if` statement, this catches the problematic variable before it reaches our calculation. However it is far less intrusive code, and `assert` tests can be added in sequence, so that we can quickly and easily increase the coverage of such tests.
232+
233+
::::::::::::::::::::::::::::::::::::::::: callout
234+
235+
## Warning when using optimisations
236+
237+
Using asserts when testing and running code while debugging is an invaluable way of checking that your code is working. However, be aware that if you are using `assert` in conjunction with optimization, then there are some built-in variables which change value when optimization is requested which have a knock-on effect on the behaviour of an `assert`; for more information look at the documentation on [the assert statement](https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement).
238+
239+
::::::::::::::::::::::::::::::::::::::::::::::::::
232240

233241
::::::::::::::::::::::::::::::::::::::: challenge
234242

md5sum.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"episodes/02-dictionaries.md" "83b33b6c48be79687521d24eae56c974" "site/built/02-dictionaries.md" "2026-04-16"
99
"episodes/03-numpy_essential.md" "72a9aa41a65900b4a87744e8f946fa00" "site/built/03-numpy_essential.md" "2026-04-16"
1010
"episodes/04-software_package_management.md" "62db2ba2a4291e16d2bdd07b77bfc961" "site/built/04-software_package_management.md" "2025-04-15"
11-
"episodes/05-defensive_programming.md" "6d48a7e584a970aacdad58a28b0b9570" "site/built/05-defensive_programming.md" "2026-04-13"
11+
"episodes/05-defensive_programming.md" "08dac8f8cc0e094ee684903fef65a5d5" "site/built/05-defensive_programming.md" "2026-04-16"
1212
"episodes/06-units_and_quantities.md" "7e259f66d6f8889505c252a04082481f" "site/built/06-units_and_quantities.md" "2026-04-13"
1313
"episodes/07-pandas_essential.md" "53da61ecedb6dcb8735ab4cc6fbe0f99" "site/built/07-pandas_essential.md" "2026-04-13"
1414
"instructors/instructor-notes.md" "a59fd3b94c07c3fe3218c054a0f03277" "site/built/instructor-notes.md" "2025-04-15"

0 commit comments

Comments
 (0)