We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Why Python?

Frankly, Python is not the best language for functional programming. Reasons include:

  1. No enforced static typing (though type hints are supported).
  2. (Almost) everything is mutable.
  3. No tail call optimization.
  4. Side effects are common.
  5. Imperative and OOP styles abound in popular libraries.
  6. Purity is not enforced (and sometimes not even encouraged).
  7. Sum types are hard to define.
  8. Pattern matching is weak at best.

So seriously, why are we using Python? One reason trumps all others: you already know Python. Python is a great choice for learning programming basics, OOP, Algorithms, and Data Structures, and we don't think the tradeoff of learning a new language at this point in the curriculum is worth it.

We'll still be able to cover the most important concepts of functional programming in Python, even if we have to jump through a hoop or two to do it. Things like:

  • Higher-order functions
  • First-class functions
  • Pure functions
  • Recursion
  • Closures
  • Currying

We plan to someday release a "Functional Programming 2" course in a more functional language. Perhaps Haskell, OCaml or Elixir.

But on the other hand... Python do be pretty popular...