proper name for python * operator?

PythonOperatorsSplat

Python Problem Overview


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

Python Solutions


Solution 1 - Python

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.

It is also referred to as iterable unpacking, or in the case of **, dictionary unpacking.

Solution 2 - Python

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

Solution 3 - Python

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

Solution 4 - Python

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

Solution 5 - Python

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.

Solution 6 - Python

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

Solution 7 - Python

The technical term for this is a Variadic function. So in a sense, that's the correct term without regard to programming language.

That said, in different languages the term does have legitimate names. As others have mentioned, it is called "splat" in ruby, julia, and several other languages and is noted by that name in official documentation. In javascript it is called the "spread" syntax. It has many other names in many other languages, as mentioned in other answers. Whatever you call it, it's quite useful!

Solution 8 - Python

For a colloquial name there is "splatting".

For arguments (list type) you use single * and for keyword arguments (dictionary type) you use double **.

Both * and ** is sometimes referred to as "splatting".

See for reference of this name being used: https://stackoverflow.com/a/47875892/14305096

Solution 9 - Python

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAnycornView Question on Stackoverflow
Solution 1 - PythonephemientView Answer on Stackoverflow
Solution 2 - PythonIgnacio Vazquez-AbramsView Answer on Stackoverflow
Solution 3 - PythonDanilo PiazzalungaView Answer on Stackoverflow
Solution 4 - PythonJohn La RooyView Answer on Stackoverflow
Solution 5 - PythonAnton StrogonoffView Answer on Stackoverflow
Solution 6 - PythonChuckView Answer on Stackoverflow
Solution 7 - PythonJames TomasinoView Answer on Stackoverflow
Solution 8 - PythonZafferView Answer on Stackoverflow
Solution 9 - PythonwberryView Answer on Stackoverflow