From the course: Functional Programming with Python

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Separation of data and functions

Separation of data and functions - Python Tutorial

From the course: Functional Programming with Python

Start my 1-month free trial

Separation of data and functions

- [Instructor] The second main concept of functional programming is the separation of data and functions. And this is a case where functional programming is directly in contrast with object-oriented programming, where data and functions are almost always grouped together. Let's see what the separation of data and functions looks like. So, first of all, for our purposes, data might be any values that a program contains. That could be employee info in a payroll program, for example, or information about cars on a used car website, or it could be data about characters in a video game. It could be anything really, all of this is data. Now in object-oriented programming, this data is usually wrapped up inside objects as member variables, and the only way that we're supposed to interact with it is using objects methods, so that's what data is. A function on the other hand, is any operation that we can apply to our data to convert it…

Contents