liveBook · Manning

Tuple

A tuple is a finite, ordered collection of values grouped as a single composite value, often with elements of different types.

How 16 Manning books explain it

Python How-To

A tuple is an ordered, immutable collection of values that can represent a fixed set of fields.

How it is used
Uses tuples to group fixed fields, carry function results, and represent pairs in container operations.
How deep it goes
Explains selection, unpacking, and shallow immutability with examples, while deferring a fuller distinction between objects and references.
Examples
Uses task records, creation metadata, and a location-coordinate selection challenge to illustrate tuple choices.
What you can do after
Apply Python tuples to fixed records and unpack their values, while recognizing when nested objects can still change.

Read how Python How-To explains tuple →

Get Programming: Learn to code with Python

A tuple is an immutable Python sequence that can contain objects of different types, including other tuples.

How it is used
Groups ordered objects and supports indexing, value swapping, and paired records of names and phone numbers.
How deep it goes
Explains creation, length, slicing, nested indexing, and swapping through examples; contrasts tuple immutability with lists.
Examples
Uses superhero names, nested tuples, a two-variable swap, and matching tuples of friends’ names and phone numbers.
What you can do after
Build it from scratch and use indexing, slicing, and tuple assignment to organize values and swap variables.

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

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

A tuple is a fixed-size, ordered data structure that combines values, potentially of different types, into a single composite value.

How it is used
Groups related values briefly within code or returns multiple results without defining a dedicated type.
How deep it goes
Works through construction, destructuring, type signatures, inference, wildcards, and struct variants, then weighs readability and representation costs.
Examples
Uses names, a name-and-age value, a tuple-transforming function, and .NET TryParse results.
What you can do after
Build it from scratch in F# by grouping and destructuring values, and choose records when named fields matter.

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

Python Workout, Second Edition

A tuple is an immutable ordered collection in Python that can represent a fixed record of related fields.

How it is used
Uses tuples for immutable records, heterogeneous fields, sequence processing, and collecting arbitrary positional arguments.
How deep it goes
Explains indexing, slicing, sorting, unpacking, formatting, and *args edge cases, but does not descend into tuple internals.
Examples
Demonstrates country records, formatted tables, *args summation, empty tuples, indexing, slicing, and first-last sequence retrieval.
What you can do after
Apply it via Python sequence operations, tuple unpacking, sorted, str.format, and *args-based functions.

Read how Python Workout, Second Edition explains tuple →

The Quick Python Book, Fourth Edition

A tuple is an ordered, immutable collection that can contain multiple values, including values of different types.

How it is used
Uses tuples as immutable sequences, basic records, and composite dictionary keys.
How deep it goes
Explains tuple syntax, sequence operations, unpacking, conversion, nested mutability, and key hashability with examples.
Examples
Demonstrates singleton syntax, variable swapping, starred unpacking, list conversion, and caching results by argument combinations.
What you can do after
Apply tuple operations, unpack values, convert sequences, and choose hashable tuple keys for dictionaries.

Read how The Quick Python Book, Fourth Edition explains tuple →

Python Workout: 50 ten-minute exercises

A tuple is an ordered, finite Python sequence that is commonly immutable and can contain elements of different types.

How it is used
Distinguishes fixed heterogeneous records from mutable homogeneous collections and packages variable function arguments.
How deep it goes
Explains immutability, sequence operations, unpacking, sorting, slicing, and splat expansion through worked Python examples.
Examples
Uses variable-argument summation, sorted person records, enumerate pairs, and comment-line filtering with startswith.
What you can do after
Apply it via Python sequence operations, argument unpacking, tuple-record sorting, and variable-argument functions.

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

Tiny Python Projects: Learn coding and testing with puzzles and games

A tuple is an immutable ordered collection of Python elements.

How it is used
Uses tuples for immutable grouped values, multiple assignment, function results, sequence pairing, and compact program state.
How deep it goes
Explains creation, indexing, unpacking, immutability, zip-generated pairs, and named tuples, stopping short of deeper implementation internals.
Examples
Demonstrates word stemming, CSV records, counter initialization, and Tic-Tac-Toe state with runnable REPL output.
What you can do after
Apply tuples to return, pair, unpack, index, and protect related Python values from reassignment.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains tuple →

Data-Oriented Programming: Reduce software complexity

A tuple is a fixed-size ordered collection whose elements may have different types or shapes.

How it is used
Uses tuples to validate function arguments inside a system during development.
How deep it goes
Defines positional heterogeneous arrays and demonstrates prefixItems, but does not detail broader tuple constraints.
Examples
Demonstrates string-number tuples and catalog-plus-query arguments for book searching.
What you can do after
Apply tuples via JSON Schema to validate fixed-position function arguments during development.

Read how Data-Oriented Programming: Reduce software complexity explains tuple →

Learn Rust in a Month of Lunches

A tuple is a fixed-size Rust composite value whose elements may have different types and are accessed by position.

How it is used
Groups fixed sets of potentially different types for positional access and combined pattern matching.
How deep it goes
Explains tuple types, dot access, destructuring, and unit returns with worked examples.
Examples
Uses a six-value mixed-type tuple, destructured Strings, a unit-returning function, and a weather match.
What you can do after
Apply tuples to group values, access positions, destructure elements, and match combinations.

Read how Learn Rust in a Month of Lunches explains tuple →

Retrieval Augmented Generation, The Foundational Ideas

A triple is a structured statement consisting of a subject, predicate, and object.

How it is used
Encodes an explicit relationship between entities as the atomic unit of knowledge-graph data.
How deep it goes
Defines the subject-predicate-object form and illustrates tuples as extracted facts loaded into a graph.
Examples
Uses (PaymentService, depends_on, AuthService) and (Thomas, researches, Alzheimer's) as tuple examples.
What you can do after
Understand how tuples encode graph relationships and how extraction converts passages into that representation.

Read how Retrieval Augmented Generation, The Foundational Ideas explains tuple →

Code Like a Pro in Rust

A tuple is a fixed-size heterogeneous sequence whose element types are specified positionally.

How it is used
Uses tuples to group fixed sets of values, especially multiple function return values.
How deep it goes
Explains positional access, destructuring, and limitations, while deferring detailed pattern matching.
Examples
Demonstrates a generic swap function, positional access, destructuring, and a tuple struct containing a String.
What you can do after
Apply tuples to return and unpack multiple values, while recognizing their limitations and the ambiguity of unnamed fields.

Read how Code Like a Pro in Rust explains tuple →

Elixir in Action, Third Edition

A tuple is an Elixir data structure containing a fixed number of terms in positional order.

How it is used
Groups a small, fixed set of fields into a positional record-like value.
How deep it goes
Explains construction, zero-based access, immutable updates, shallow copying, and the boundary with dynamically sized lists.
Examples
Uses a person tuple, elem/2, put_elem/3, rebinding, and a shallow-copy illustration.
What you can do after
Apply it via elem/2 and put_elem/3 while preserving the original value through rebinding.

Read how Elixir in Action, Third Edition explains tuple →

Essential TypeScript 5, Third Edition

A tuple type is a TypeScript array-like type with a fixed ordered sequence of specified element types, optionally including optional or rest positions.

How it is used
Models fixed-position product data and other JavaScript array-shaped values whose positions require different types.
How deep it goes
Explains declarations, indexing, processing, unions, optional positions, and rest positions, while noting runtime array implementation and rest-element trade-offs.
Examples
Uses product names and prices, optional tax rates, coupon rest values, tuple arrays, and boolean-or-tuple unions.
What you can do after
Apply it via the TypeScript compiler to define, access, destructure, iterate, and narrow fixed-position arrays.

Read how Essential TypeScript 5, Third Edition explains tuple →

Julia as a Second Language

A tuple is a fixed-size ordered collection whose elements may have different types and whose contents cannot be changed.

How it is used
Uses tuples to represent fixed records with mixed-type fields inside spreadsheet-like data collections.
How deep it goes
Explains construction, element types, indexing, iteration, numeric functions, and immutability, while deferring the broader type system.
Examples
Demonstrates pizza records, pizza sales tables, tuple arrays, field-accessor functions, and numeric summaries.
What you can do after
Evaluate/understand tuple records, read and iterate their values, inspect their types, and organize them into sales data.

Read how Julia as a Second Language explains tuple →

Functional Programming in JavaScript

A finite ordered collection of fixed length that groups multiple values into a single composite value.

How it is used
Uses tuples to package multiple function results into one value, especially when reducing function arguments and supporting reusable pipelines.
How deep it goes
Defines tuples, demonstrates returned values, and implements typed immutable tuples with arity and value checks.
Examples
Uses validation status and error messages, typed status tuples, triangle-angle values, and string pairs.
What you can do after
Build typed immutable tuples in JavaScript and use them to return and pass related values as one result.

Read how Functional Programming in JavaScript explains tuple →

100 C++ Mistakes and How to Avoid Them

A tuple is a fixed-size aggregate that stores values of potentially different types in a specified order without requiring user-supplied field names.

How it is used
Replaces repetitive POD structs with compact aggregates when a class’s fuller semantics are unnecessary.
How deep it goes
Defines fields by ordered types, demonstrates indexed std::get access, and warns identical aliases denote the same type; structured binding is pointed to as an alternative.
Examples
Demonstrates Student data—name, age, and GPA—as both a named struct and a tuple.
What you can do after
Build it from scratch by aliasing std::tuple fields, initializing values, and accessing them with std::get indices.

Read how 100 C++ Mistakes and How to Avoid Them explains tuple →

Also covered in

What to know first

Related concepts

Questions about tuple

What is tuple?

A tuple is a finite, ordered collection of values grouped as a single composite value, often with elements of different types.

Which Manning books explain tuple?

Python How-To, Get Programming: Learn to code with Python, F# in Action: A Revised Edition of Get Programming with F#, Python Workout, Second Edition, The Quick Python Book, Fourth Edition, Python Workout: 50 ten-minute exercises, Tiny Python Projects: Learn coding and testing with puzzles and games, Data-Oriented Programming: Reduce software complexity and 8 more.

What should I know before learning tuple?

Manning books that teach tuple usually introduce string, array, list and loop first.

What is the difference between tuple and list?

A tuple is a finite, ordered collection of values grouped as a single composite value, often with elements of different types. A list is an ordered collection of elements arranged in a sequence.

What kinds of tuple are there?

Kinds of tuple include unit type, named tuple and one-element tuple.

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.