liveBook · Manning

Inner function

Also called nested function

An inner function is a function defined within the body or scope of another function.

How 5 Manning books explain it

Python How-To

A nested function is a function defined within the body of another function.

How it is used
Uses inner functions to create configured callables and decorator wrappers.
How deep it goes
Explains nested definitions, returned functions, and enclosing-variable assignment, while deferring a full explanation of closures.
Examples
Demonstrates increment-making functions and a choice between local and nonlocal assignment.
What you can do after
Build inner functions from scratch to create configured callables and update enclosing variables with nonlocal.

Read how Python How-To explains inner function →

F# in Action: A Revised Edition of Get Programming with F#

A nested function is a function defined inside another scope or function.

How it is used
Uses inner functions to keep small helpers local to the function that needs them.
How deep it goes
Defines nested functions, shows a local call, and explains outer-value capture without detailing compiler mechanics.
Examples
Uses a greeting-formatting helper and a city binding read from an outer scope.
What you can do after
Apply it via F# to define a local helper and use a preceding outer binding inside it.

Read how F# in Action: A Revised Edition of Get Programming with F# explains inner function →

Get Programming: Learn to code with Python

A function defined within the scope of an enclosing function.

How it is used
Explains how to organize task-specific helpers and create specialized functions within an enclosing function.
How deep it goes
Defines nesting, scope, returned function objects, and chained execution through small examples and trace exercises.
Examples
Uses singing stops, chained message functions, area helpers, student vacation details, and file-data analysis helpers.
What you can do after
Build it from scratch by defining task-specific inner functions, calling them within scope, and returning function objects when useful.

Read how Get Programming: Learn to code with Python explains inner function →

Python Workout, Second Edition

An inner function is a function defined within the scope of another function or enclosing code block.

How it is used
Uses inner functions to generate multiple specialized password functions from different character strings.
How deep it goes
Explains definition timing, returned functions, enclosing-scope access, and LEGB lookup, but stops short of broader closure mechanics.
Examples
Demonstrates password generators for alphabetic and symbol character sets, with lengths five and ten.
What you can do after
Build it from scratch: define, return, and invoke specialized password generators that retain an outer character set.

Read how Python Workout, Second Edition explains inner function →

Python Workout: 50 ten-minute exercises

An inner function is a function defined within the body of another function.

How it is used
Uses inner functions to create reusable password generators with different character restrictions.
How deep it goes
Explains definition, creation timing, returned functions, closures, and LEGB lookup, stopping short of broader closure mechanics.
Examples
Demonstrates password generators for alphabetic and symbolic character sets, including multiple returned functions and generated outputs.
What you can do after
Build reusable function factories that retain configuration from an outer call.

Read how Python Workout: 50 ten-minute exercises explains inner function →

Also covered in

What to know first

Related concepts

Questions about inner function

What is inner function?

An inner function is a function defined within the body or scope of another function.

Which Manning books explain inner function?

Python How-To, F# in Action: A Revised Edition of Get Programming with F#, Get Programming: Learn to code with Python, Python Workout, Second Edition and Python Workout: 50 ten-minute exercises.

What should I know before learning inner function?

Manning books that teach inner function usually introduce function, object, scope and function declaration first.

What is the difference between inner function and hook call?

An inner function is a function defined within the body or scope of another function. A hook call is an invocation of a React Hook during the execution of a function component or custom hook.

What is inner function a kind of?

Inner function is a kind of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.

What is inner function part of?

Inner function is part of enclosing function. An enclosing function is a function whose body contains a nested function definition and provides a surrounding lexical scope for it.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.