AI engineering glossary · Python core

What is *args?

*args: A parameter written with a leading star that gathers any extra positional arguments into a tuple. It lets a function accept a variable number of inputs. Inside the function you loop over it like any tuple, and the name args is only a convention.

Level: intermediateTopic: Python core

*args: an example

def total(*args): return sum(args); total(1, 2, 3) returns 6 because args is (1, 2, 3).

Related terms

More Python core terms

Where you learn it

*args is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.