1. Advanced Python functions

    • Buy now
    • Learn more
    • 01 Welcome
  2. Section 1: Function objects

    • Section 1 — Function objects.ipynb
    • 02 Introduction to function objects
    • 03 Function objects and bytecode
    • 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
    • 16 Writing function wrappers
    • 17 Exercises 2
    • exercises-2.txt
    • 18 Exercise 2 solutions
  3. Section 2: Scoping and nested functions

    • Section 2 — Scoping and nested functions.ipynb
    • 19 Exploring __code__
    • 20 Scoping — LEGB
    • 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
    • 37 Conclusion
  1. Products
  2. Course
  3. Section

Section 2: Scoping and nested functions

  1. Advanced Python functions

    • Buy now
    • Learn more
    • 01 Welcome
  2. Section 1: Function objects

    • Section 1 — Function objects.ipynb
    • 02 Introduction to function objects
    • 03 Function objects and bytecode
    • 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
    • 16 Writing function wrappers
    • 17 Exercises 2
    • exercises-2.txt
    • 18 Exercise 2 solutions
  3. Section 2: Scoping and nested functions

    • Section 2 — Scoping and nested functions.ipynb
    • 19 Exploring __code__
    • 20 Scoping — LEGB
    • 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
    • 37 Conclusion

21 Lessons
    • Section 2 — Scoping and nested functions.ipynb
    • 19 Exploring __code__
    • 20 Scoping — LEGB
    • 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
    • 37 Conclusion