问题:python *运算符的专有名称?
什么是运营商的正确名称*
,如function(*args)
?打开包装,解压缩,还有其他东西吗?
What is the correct name for operator *
, as in function(*args)
? unpack, unzip, something else?
回答 0
在Ruby和Perl 6中,这被称为“ splat”,我认为那些社区的大多数人都会明白您的意思。
在Python的教程使用短语“拆包参数列表”,这是长和描述。我在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.
回答 1
我称之为“位置扩展”,与之相反**
,我称之为“关键字扩展”。
I call it “positional expansion”, as opposed to **
which I call “keyword expansion”.
回答 2
回答 3
我说“ star-args”,Python的人似乎知道我的意思。
**
比较棘手-我认为只是“ qargs”,因为它通常用作**kw
或**kwargs
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
回答 4
回答 5
我相信它最常被称为“ splat运算符”。解压缩参数是它的作用。
回答 6
我将* args称为“ star args”或“ varargs”,并将** kwargs称为“ keyword args”。
I call *args “star args” or “varargs” and **kwargs “keyword args”.