From the course: Python Essential Training
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Functions as variables - Python Tutorial
From the course: Python Essential Training
Functions as variables
Variables have a name and some data associated with them. Functions have a function name and some data associated with them. Okay. In the case of a function, this data is information about the required parameters, if any, and also some lines of instruction that need to be executed. And a function is actually represented in Python as an object. And we can see this using the underscore, underscore code attribute of Python function objects. Okay. So if I print out co var names, let's do print in here, and then print, co code, okay. So here are the variable names, in this case we don't have any, and also a Python byte object of all of the lines of instruction in this function. Now, you'll probably never actually need to use this. I actually looked it up specifically for this lesson. So please don't take notes on underscore underscore code. You're just you're not going to need it. But what you do need to know is that functions are not anything special in Python. They are just variables…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.