[Python-Dev] Very Strange Argument Handling Behavior

Dino Viehland dinov at microsoft.com
Fri Apr 16 17:22:34 CEST 2010


Mark Dickinson wrote: 
> Removing it certainly seems in keeping with the goal of making life
> easier for alternate implementations.  (Out of curiosity, does anyone
> know what IronPython does here?)
> 
> I've opened http://bugs.python.org/issue8419


It looks like IronPython reports a type error as well:

IronPython 2.6.1 DEBUG (2.6.10920.0) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(**kwargs):
...     print(kwargs)
...
>>> kwargs = {1: 3}
>>>
>>> dict({}, **kwargs)
Traceback (most recent call last):
  File "<stdin>", line unknown, in <module>
TypeError: expected string for dictionary argument got 1
>>> d = {1:2}
>>> d.update({3:4}, **{5:6})
Traceback (most recent call last):
  File "<stdin>", line unknown, in <module>
TypeError: expected string for dictionary argument got 5





More information about the Python-Dev mailing list