October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Pass Tuples to Python Functions

Use f(my_tuple) to pass one tuple object, or f(*my_tuple) to pass its items as separate positional arguments. The function signature tells you which to choose.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use f(my_tuple) when a function should receive one tuple object. Use f(*my_tuple) when the tuple’s items should become separate positional arguments. The function signature determines which form is right.

Pass a tuple as one argument

Calling a function with the tuple name passes the tuple intact. The function receives one argument and can unpack its contents inside its body.

def describe(person):
    name, age = person
    return f"{name} is {age}"

person = ("Ada", 36)
print(describe(person))

Here, describe has one parameter, person. Inside the function, name, age = person assigns the tuple’s two values to local variables.

Unpack tuple items into separate positional arguments

Put * before the tuple at the call site to expand its items into positional arguments. The function must have a matching parameter for each item, in the right order.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
def describe(name, age):
    return f"{name} is {age}"

person = ("Ada", 36)
print(describe(*person))

This is equivalent to calling describe("Ada", 36). Python’s tutorial on unpacking argument lists uses the same pattern with range(*args).

Call Arguments received Suitable signature
f(values) One argument: the tuple values def f(values):
f(*values) One positional argument per tuple item For two items: def f(first, second):

Python’s built-in types documentation likewise distinguishes f(a, b, c), which passes three arguments, from f((a, b, c)), which passes one 3-tuple.

Collect positional arguments with *args

In a function definition, *args collects extra positional arguments into a tuple. This is the reverse direction from *values in a call, which expands an iterable into arguments.

def report(first, *args):
    print("first:", first)
    print("remaining positional arguments:", args)

report("a", "b", "c")

The call prints first: a and then remaining positional arguments: ('b', 'c'). The parameter name args is conventional; the asterisk gives it this collecting behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Forward positional and keyword arguments

A wrapper can collect positional arguments in a tuple and keyword arguments in a dictionary, then pass both on to another function:

def wrapper(*args, **kwargs):
    return target(*args, **kwargs)

Use * to expand positional values from a tuple or other iterable. Use ** to expand keyword arguments from a mapping of names to values; it is not the way to unpack tuple items. See the Python FAQ’s explanation of argument collection and forwarding.

Choose the call from the function signature

  • If the function has one parameter meant to hold a tuple, call it as f(values).
  • If the function has a separate parameter for each tuple item, call it as f(*values).
  • After expansion, check that the number and order of positional values match the parameters. For keyword arguments, check that each name is accepted.

For example, if a function expects two positional parameters, f(values) supplies too few arguments: it passes just one tuple. Conversely, f(*values) supplies too many if the function expects one tuple-valued parameter and the tuple has several items.

Fix common tuple argument errors

  • Wrong argument count: Choose between f(values) and f(*values) based on the function’s parameters.
  • Duplicate parameter value: Do not supply the same parameter once positionally and again by name. For example, function(0, a=0) raises a TypeError if both values target parameter a.
  • Using ** with a tuple: Keyword expansion needs a mapping with keyword names. Use * to expand tuple items positionally.
  • Missing comma in a one-item tuple: Write (5,), not (5). The latter is the integer 5, because the comma—not the parentheses—makes a tuple, as the built-in types documentation notes.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Annotate tuple parameters and variadic arguments

When a function receives a tuple intact, annotate the tuple-valued parameter. For example, tuple[int, int] describes a two-item tuple of integers:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
def consume(point: tuple[int, int]) -> None:
    ...

For a function that collects positional arguments, *args: int indicates that each collected argument is an integer. Python 3.14’s typing documentation also covers type variable tuples and *args: *Ts for preserving a callable’s varying positional argument types. Choose annotation forms supported by the Python versions your project targets.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.