[Python-Dev] Very Strange Argument Handling Behavior

Terry Reedy tjreedy at udel.edu
Fri Apr 16 20:40:37 CEST 2010


On 4/16/2010 11:22 AM, Dino Viehland wrote:
> 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

If the current CPython behavior is deprecated in 3.2, then I think 
IronPython should keep its current behavior (and future Cpython 
behavior) in IP 3.2 and not change it for one version.

tjr





More information about the Python-Dev mailing list