Question

What is the correct name for operator *, as in function(*args)? unpack, unzip, something else?

Was it helpful?

Solution

In Ruby and Perl 6 this has been called "splat", and I think most people from those communities will figure out what you mean if you call it that.

The Python tutorial uses the phrase "unpacking argument lists", which is long and descriptive. I haven't heard any other particular name for it in Python.

OTHER TIPS

I call it "positional expansion", as opposed to ** which I call "keyword expansion".

The Python Tutorial simply calls it 'the *-operator'. It performs unpacking of arbitrary argument lists.

I say "star-args" and Python people seem to know what i mean.

** is trickier - I think just "qargs" since it is usually used as **kw or **kwargs

One can also call * a gather parameter (when used in function arguments definition) or a scatter operator (when used at function invocation).

As seen here: Think Python/Tuples/Variable-length argument tuples.

I believe it's most commonly called the "splat operator." Unpacking arguments is what it does.

I call *args "star args" or "varargs" and **kwargs "keyword args".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top