4 ms·
The issue with your second version is In [1]: def init(shapename=None, **kwargs): ...: pass ...: In [2]: init(shapename='circle', **{'shape
by teh 15y ago
The issue with your second version is
In [1]: def init(shapename=None, **kwargs):
...: pass
...:
In [2]: init(shapename='circle', **{'shapename': 'circle'})
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/teh/Desktop/<ipython console> in <module>()
TypeError: init() got multiple values for keyword argument 'shapename'
- Peristarkawan 15y agoThat's entirely the caller's fault, not the function's. Compare: >>> def init(**kwargs): ... pass ... >>> init(shapename='circle', **{'shapename': 'circle'}) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: init() got multiple values for keyword argument 'shapename'