【发布时间】:2012-07-07 03:09:04
【问题描述】:
Python 函数参数中没有标识符的单个 * 是什么意思? 这是一个适用于 Python3.2 的示例:
class Shape:
def __init__(self, *, shapename, **kwds):
self.shapename = shapename
super().__init__(**kwds)
对我来说,自我之后的星星很奇怪。
我在这里找到了它(从第 46 行开始): http://code.activestate.com/recipes/577720-how-to-use-super-effectively/
【问题讨论】:
-
为指向 PEP 的人加分 ;) (我记得读过一段 PEP 描述这一点,但我不记得在哪里,或者它是什么,/me 去了返回谷歌)
标签: python function python-3.x