No, Python's unpacking operator (sometimes called "splat" or "spread") never used the ...
ellipsis symbol. Python has an ...
/Ellipsis
literal value, but it's only used as a singleton constant for expressing multidimensional ranges in libraries like NumPy. It has no intrinsic behavior and is not syntactically valid in locations where you would use the *
unpacking operator.
We can see that the change log for Python 2.0 (released in 2000) describes the new functionality of being able to use the *
unpacking operator to call a function, but using the *
asterisk character to define a variadic function (sometimes called using "rest parameters") is older than that.
A new syntax makes it more convenient to call a given function with a tuple of arguments and/or a dictionary of keyword arguments. In Python 1.5 and earlier, you’d use the apply()
built-in function: apply(f, args, kw)
calls the function f()
with the argument tuple args
and the keyword arguments in the dictionary kw
. apply()
is the same in 2.0, but thanks to a patch from Greg Ewing, f(*args, **kw)
is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions.
The source code for Python 1.0.1 (released in 1994) is still available from the Python website, and we can look at some of their examples to confirm that the use of the *
asterisk character for variadic function definitions existed even then. From Demo/sockets/gopher.py
:
# Browser main command, has default arguments
def browser(*args):
selector = DEF_SELECTOR
host = DEF_HOST
port = DEF_PORT
n = len(args)
if n > 0 and args[0]:
selector = args[0]