Write Unbreakable Python

In this article, I’ll show you how to write Python with no runtime exceptions. This’ll get you partway to writing code that never breaks and mostly does what it’s supposed to do. We’ll do this by learning how to apply functional programming to Python. We’ll cover:

  • ensure functions always work by learning Pure Functions
  • avoid runtime errors by return Maybes
  • avoid runtime errors in deeply nested data using Lenses
  • avoid runtime errors by return Results
  • creating pure programs from pure functions by Pipeline Programming
Continue reading “Write Unbreakable Python”

Error Handling Strategies


There are various ways of handling errors in programming. This includes not handling it. Many languages have created more modern ways of error handling. An error is when the program, intentionally, but mostly not, breaks. Below, I’ll cover the 4 main ones I know: try/catch, explicit returns, either, and supervising crashes. We’ll compare various languages on how they approach errors: Python, JavaScript, Lua, Go, Scala, Akka, and Elixir. Once you understand how the newer ways work, hopefully this will encourage you to abandon using potentially program crashing errors via the dated throw/raise in your programs.
Continue reading “Error Handling Strategies”

Functional Programming for OOP Developers: Part 2 – No Errors and Getting Things


In my journey to learn functional programming and drink deep of the kool-aid, I wanted to share my latest learnings. Specifically around the quest for no errors and how you get things.

I’ve also just recently applied these same concepts in Python, not just JavaScript, so I’ll mix and match the examples to show how the concepts are universal.

After reading this article, you should understand why errors aren’t helpful embedded in your code & avoiding them is good and why we use functions to get things instead of the old way of assigning variables. Check out the first article if you missed it.
Continue reading “Functional Programming for OOP Developers: Part 2 – No Errors and Getting Things”