O'Reilly logo
live online training icon Live Online training

Python Next Steps: Functions, Parameters, Closures, & Decorators

Exploring functions in a hands-on fashion

Topic: Software Development
Matt Harrison

In Python everything is an object, which has important ramifications for functions.

Join expert Matt Harrison to dive into Python functions. You’ll learn what goes on behind the scenes, explore parameter types and more, and get hands-on with powerful higher-order operations and decorators.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • What a function is
  • What types of parameters they support
  • How to write a decorator

And you’ll be able to:

  • Determine what type of parameter to use for functions
  • Determine when to use a decorator

This training course is for you because...

  • You’re a software engineer who’s looking to better understand Python.
  • You work with code and want to write more efficient code.
  • You want to become a better Python programmer.

Prerequisites

  • Basic Python knowledge (i.e., the ability to use an editor and write simple code)

Recommended preparation:

Recommended follow-up:

About your instructor

  • Matt runs MetaSnake, a Python and Data Science training and consulting company. He has over 15 years of experience using Python across a breadth of domains: Data Science, BI, Storage, Testing and Automation, Open Source Stack Management, and Search.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Function basics (25 minutes)

  • Presentation: Functions; parameters; return values
  • Katacoda interactive exercise: Functions
  • Q&A

Docstrings (25 minutes)

  • Presentation: Docstrings; getting help
  • Katacoda interactive exercise: Docstring
  • Q&A

Default parameters (20 minutes)

  • Presentation: Default parameters
  • Katacoda interactive exercise: Default parameters
  • Q&A

Break (5 minutes)

Variable parameters (25 minutes)

  • Presentation: Variable parameters; args; *kwargs; getting help
  • Katacoda interactive exercise: Variable parameters
  • Q&A

Keyword-only parameters (25 minutes)

  • Presentation: Keyword-only parameters
  • Katacoda interactive exercise: Keyword only
  • Q&A

Positional-only parameters (20 minutes)

  • Presentation: Positional-only parameters
  • Katacoda interactive exercise: Positional only
  • Q&A

Break (5 minutes)

Closures (30 minutes)

  • Presentation: Closures
  • Katacoda interactive exercise: Closures
  • Q&A

Decorators (20 minutes)

  • Presentation: Decorators; when to use them
  • Katacoda interactive exercise: Decorators

Wrap-up and Q&A (10 minutes)