Skip to content

Commit 34c7fcc

Browse files
authored
Fix EAFP link formatting in defensive programming section
Corrected the formatting of the EAFP link in the text.
1 parent 8126441 commit 34c7fcc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

episodes/05-defensive_programming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ except:
110110
```
111111
112112
At the top of the statement is the code that we are interested in executing, which is run in the `try` statement. If that fails then the `except` statement comes into effect, (hopefully) returning helpful information to the user about what happened and giving them some guidance on how to avoid the problem in future.
113-
Using `try-except` statements results in clearer, easier to understand code by following the common Python coding style of (EAFP)[https://docs.python.org/3.6/glossary.html#term-eafp] (it's easier to ask for forgiveness than permission). This style shows the code we want to execute first, assuming that the incoming data is correct, before dealing with exceptions if the assumptions are false.
113+
Using `try-except` statements results in clearer, easier to understand code by following the common Python coding style of [EAFP](https://docs.python.org/3.6/glossary.html#term-eafp) (it's easier to ask for forgiveness than permission). This style shows the code we want to execute first, assuming that the incoming data is correct, before dealing with exceptions if the assumptions prove false.
114114
115115
The `except` statement will catch all errors and so we do not, initially at least, need to know exactly what errors we are trying to avoid. However, python does provide error codes, which we can use to expand the structure to capture specific error types. For the example above, we would want to capture a `TypeError`:
116116

0 commit comments

Comments
 (0)