Functions: *args

>>> def concat(*args, sep="/"):
...     return sep.join(args)
...
>>> concat("earth", "mars", "venus")
'earth/mars/venus'
>>> concat("earth", "mars", "venus", sep=".")
'earth.mars.venus'
  • used when you aren’t sure how many arguments are going to be passed to a function, or if you want to pass a stored list or tuple of arguments to a function.
  • Arbitrary number of arguments.
  • These arguments will be wrapped up in a tuple.

Related concepts

Functions: *args — Structure map

Clickable & Draggable!

Functions: *args — Related pages: