Reuven Lerner's Python Courses/Advanced Python functions

  • $180

Advanced Python functions

Already know how to define and call Python functions? Go deeper, from bytecodes to closures, and truly master them.

Get this course, and many others, as part of my LernerPython membership, at https://LernerPython.com.

Defining functions is just the beginning.

If you have been programming in Python for a while, then you've probably written hundreds, or even thousands, of functions.

In this course, we go behind the scenes to understand what happens when you define a function, and also when you then execute that function.  We'll look at bytecodes, at function objects, at the ways in which Python handles and tracks different types of arguments.  We'll also look at "inner functions" — functions defined inside of other functions — and how Python keeps track of the different variable scopes present in our functions.

We'll also consider the difference between functions and stack frames, and will touch on typing with Mypy, as well.

If you want to understand how Python's functions are defined, stored, and then executed, this is the course for you. You'll learn a great deal that'll help you to write better, more fluent Python code — and thus get more done in less time.

Contents

01 Welcome
  • 2 mins
  • 43.7 MB

Section 1: Function objects

Section 1 — Function objects.ipynb
  • 97 KB
02 Introduction to function objects
  • 5 mins
  • 114 MB
03 Function objects and bytecode
  • 8 mins
  • 187 MB
Preview
04 Arguments and local variables
  • 4 mins
  • 92.5 MB
05 Disassembling our function
  • 7 mins
  • 163 MB
06 More arguments
  • 4 mins
  • 85.3 MB
07 Defaults
  • 12 mins
  • 280 MB
08 Disassembling defaults
  • 6 mins
  • 128 MB
09 *args
  • 7 mins
  • 156 MB
10 keyword-only parameters
  • 7 mins
  • 157 MB
11 Exercises 1
  • 3 mins
  • 58 MB
exercises-1.txt
  • 1.61 KB
12 Exercise 1 solutions
  • 9 mins
  • 188 MB
13 **kwargs
  • 9 mins
  • 193 MB
14 When to use **kwargs
  • 8 mins
  • 182 MB
15 Unpacking *iterables and **dicts
  • 6 mins
  • 125 MB
Preview
16 Writing function wrappers
  • 5 mins
  • 99.7 MB
17 Exercises 2
  • 2 mins
  • 41.9 MB
exercises-2.txt
  • 1.27 KB
18 Exercise 2 solutions
  • 7 mins
  • 155 MB

Section 2: Scoping and nested functions

Section 2 — Scoping and nested functions.ipynb
  • 224 KB
19 Exploring __code__
  • 14 mins
  • 306 MB
20 Scoping — LEGB
  • 18 mins
  • 401 MB
Preview
21 Inner functions.mp4
  • 6 mins
  • 120 MB
22 Visualizing inner functions
  • 4 mins
  • 91.5 MB
23 Enclosing variables
  • 8 mins
  • 177 MB
24 Using enclosing variables
  • 6 mins
  • 123 MB
25 nonlocal
  • 10 mins
  • 218 MB
26 __code__ and enclosing scope
  • 5 mins
  • 110 MB
27 Multiple nestings
  • 5 mins
  • 109 MB
28 Use case 1 — Semi-static variables
  • 7 mins
  • 151 MB
29 Use case 2 — Function factories
  • 4 mins
  • 93.6 MB
30 Exercises 3
  • 3 mins
  • 63.1 MB
exercises-3.txt
  • 1.71 KB
31 Exercise 3 solutions
  • 6 mins
  • 121 MB
32 Intro to stack frames
  • 8 mins
  • 176 MB
33 Functions vs. frames
  • 4 mins
  • 88 MB
34 The "inspect" module
  • 4 mins
  • 71.8 MB
35 Inspecting stack frames
  • 7 mins
  • 153 MB
36 Type annotations
  • 8 mins
  • 176 MB
Preview
37 Conclusion
  • 2 mins
  • 39.2 MB

FAQs

Who should take this course?

Python developers who are comfortable writing functions, but want to more fully understand and take advantage of what Python has to offer.

What version of Python do you use?

3.7 — I didn't have 3.8 running on my computer when producing the course.

If you have Python 3.6 or above,then you're fine for this course.

Is there a “trial” version or sample?

No, but (a) you can view a number of the videos for free, without purchasing the course, and (b) I offer a 100% guaranteed refund if you need.  

Is automated testing a part of this course?

No, but I am preparing a separate course on "pytest" that will cover functions (among other topics).

I live in Israel. How do you handle issues like VAT?

If you live in Israel, then please don't buy any of my products (including Weekly Python Exercise) via this online platform. I'm obligated to collect VAT from you, and then to pass it along to the government.  Instead, please e-mail me for information about sending me a bank transfer. I'll then add you to the course, but we'll be able to handle it in the standard and legal way. I apologize for this frustration -- believe me, I wish that the platform I use for selling courses would support Israeli VAT, and I keep asking them to do so.

What if I find that the course is too easy or hard, or that I just dislike your jokes?

If you aren't satisfied with my course, then I'll refund your money.  Just e-mail me.  I believe that I'm offering a high-quality product, but I also know that it's not for everyone.

As for the jokes, people have been trying to help me for years. So far, my jokes have just gotten worse, not better. Oh, well.

Do you offer any discounts?

Yes, I offer discounts for students, pensioners/retirees, and anyone living outside of the world's 30 richest countries. E-mail me at reuven@lerner.co.il for an appropriate coupon code.

As of February 2020, I also offer a significant discount for anyone affected financially by the coronavirus pandemic. Contact me for more details.

I have other questions. What should I do?

Contact me at reuven@lerner.co.il!