liveBook · Manning

Tuple

A tuple is a finite, ordered collection of elements treated as a single composite value or record.

How 15 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
Stores ordered, fixed fields such as task metadata and extracted records while lists hold collections that may change.
How deep it goes
Explains immutability through assignment errors, distinguishes mutable contents, and demonstrates unpacking; stops short of tuple implementation internals.
Examples
Uses task metadata, an item-assignment error, three-field unpacking, regular-expression records, and key-value pairs.
What you can do after
Build it from scratch as a fixed-field container, and unpack its items or choose a list when updates are required.

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 short-lived values for function inputs, multiple results, and lightweight local data.
How deep it goes
Explains construction, deconstruction, signatures, inference, wildcards, nesting, struct tuples, and trade-offs; defers complex modeling to records.
Examples
Uses name pairs, name-and-age values, a doctor-title function, nested tuples, and `TryParse` results.
What you can do after
Apply it to create, deconstruct, annotate, and selectively discard tuple values while choosing records for richer models.

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 fixed sequences and as keys for dictionaries, including caches indexed by argument combinations.
How deep it goes
Works through creation, reading, immutability, packing, conversion, and key eligibility without examining tuple implementation internals.
Examples
Demonstrates indexing errors, one-element syntax, starred unpacking, list conversion, and a tuple-keyed cache.
What you can do after
Practice/perform it by creating and unpacking Python tuples and checking whether they qualify as dictionary keys.

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 different types for positional access, simultaneous variable binding, and matching multiple values.
How deep it goes
Explains syntax, element types, dot access, destructuring, and the unit type without descending into implementation internals.
Examples
Uses a six-item mixed-type tuple, three-string destructuring, and a weather match on two values.
What you can do after
Build it from scratch in Rust, access its items by position, and unpack or match its values.

Read how Learn Rust in a Month of Lunches 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-position values, especially when returning multiple values from a function.
How deep it goes
Defines tuple shape and demonstrates access, destructuring, and return values; defers detailed pattern matching.
Examples
Shows positional printing, `match` and `let` destructuring, and a generic `swap` function returning `(B, A)`.
What you can do after
Apply tuples to small positional groups and multiple return values while avoiding array-like operations and oversized tuples.

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 structures for simple heterogeneous aggregates when full class semantics are unnecessary.
How deep it goes
Explains definition, construction, indexed access, generalization, and type-identity risks, while pointing to structured binding for improved access.
Examples
Uses a Student aggregate containing a name, age, and GPA, plus a templated tuple alias.
What you can do after
Build it from scratch with std::tuple, initialize heterogeneous values, and retrieve them by index.

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

Related concepts

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.