2TWO PYTHON PARADIGMS

Image

Now that we’ve explored some topics in the Python programming language, let’s learn about the two main paradigms we can use to write code. In this second chapter on Python, we’ll discuss the functional and object-oriented programming paradigms and the benefits each brings. We’ll wrap up with a brief look at type hints. Let’s get started.

Functional Programming

Functional programming is a programming paradigm, which means that it’s a style of writing code we can decide to adhere to. For us to say “we’re writing functional-style code” we have to follow some simple rules that define what functional programming is about.

The ...

Get Hardcore Programming for Mechanical Engineers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.