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.
*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
- Argument
- Arithmetic operator
- Assignment
- Augmented assignment
- break
- Comment
- Comparison operator
- Conditional expression
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.