LernerPython

Advanced functions

There’s much more to Python functions than “def”. Learn how functions really work, including advanced parameters and scoping.

What you should know

Course Content

Course length

4 hours

Number of lessons

37

Training materials

5 PDFs + notebooks

Coding exercises

7

LEARN MORE

Defining functions is no natural and easy in Python, it’s easy to think that there isn’t much to them.

But in fact, Python’s functions are extremely sophisticated. They’re compiled into byte codes. They support many different ways to map arguments to parameters, You can nest functions, returning closures. And that’s just the beginning.

In this course, you’ll go way beyond “def” and simple parameters, to really understand what’s happening under the hood in Python functions. You’ll write inner functions and use closures. You’ll even explore stack frames, and see how they can help us understand how Python does things.

If you write functions — and as a Python coder, you almost certainly do — but want to really understand them in depth, then this course is for you, with not only a better theoretical understanding, but also practical tips and tools for your day-to-day coding.

  • All of Python’s parameter types, and how arguments are mapped to them
  • How bytecodes work
  • What hidden information is contained in a function’s __code__ object
  • How nested functions work, and why you would want to use them
  • How variables are stored in stack frames

This course, like all others on LernerPython, is taught by Reuven Lerner.