Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Nested Functions | Variable Scope
Intermediate Python: Arguments, Scopes and Decorators

Nested FunctionsNested Functions

This topic will not only help understand the nonlocal scope but also closures and decorators.

Functions are first-class citizens in Python. They can be:

  • Passed as arguments to functions;
  • Returned from functions;
  • Modified;
  • Assigned to variables.

Let's explore some examples:

In programming, a nested function is a function that is defined inside another function.

Useful if you want to perform a complex task multiple times within another function without repeating code.

¿Todo estuvo claro?

Sección 4. Capítulo 4
course content

Contenido del Curso

Intermediate Python: Arguments, Scopes and Decorators

Nested FunctionsNested Functions

This topic will not only help understand the nonlocal scope but also closures and decorators.

Functions are first-class citizens in Python. They can be:

  • Passed as arguments to functions;
  • Returned from functions;
  • Modified;
  • Assigned to variables.

Let's explore some examples:

In programming, a nested function is a function that is defined inside another function.

Useful if you want to perform a complex task multiple times within another function without repeating code.

¿Todo estuvo claro?

Sección 4. Capítulo 4
some-alt