[Python-Dev] repeated keyword arguments

Scott Dial scott+python-dev at scottdial.com
Fri Jun 27 23:40:21 CEST 2008


David Wolever wrote:
> I don't have 2.4 handy to test it, but it is more likely that a keyword 
> and dictionary are passed, both containing the same item:
>  >>> f(a=3, **{'a': 4})
> 
> Would that be a potential risk?

Python 2.4.3
 >>> f(a=3, **{'a': 4})
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: f() got multiple values for keyword argument 'a'

Python 2.5
 >>> f(a=3, **{'a': 4})
TypeError: f() got multiple values for keyword argument 'a'

The regression is purely in the way an argument list is reduced to a 
dictionary.

-- 
Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu


More information about the Python-Dev mailing list