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

Section 1: Function objects

Section 1 — Function objects.ipynb
02 Introduction to function objects
03 Function objects and bytecode
Preview
04 Arguments and local variables
05 Disassembling our function
06 More arguments
07 Defaults
08 Disassembling defaults
09 *args
10 keyword-only parameters
11 Exercises 1
exercises-1.txt
12 Exercise 1 solutions
13 **kwargs
14 When to use **kwargs
15 Unpacking *iterables and **dicts
Preview
16 Writing function wrappers
17 Exercises 2
exercises-2.txt
18 Exercise 2 solutions

Section 2: Scoping and nested functions

Section 2 — Scoping and nested functions.ipynb
19 Exploring __code__
20 Scoping — LEGB
Preview
21 Inner functions.mp4
22 Visualizing inner functions
23 Enclosing variables
24 Using enclosing variables
25 nonlocal
26 __code__ and enclosing scope
27 Multiple nestings
28 Use case 1 — Semi-static variables
29 Use case 2 — Function factories
30 Exercises 3
exercises-3.txt
31 Exercise 3 solutions
32 Intro to stack frames
33 Functions vs. frames
34 The "inspect" module
35 Inspecting stack frames
36 Type annotations
Preview
37 Conclusion

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!