[Python-Dev] Very Strange Argument Handling Behavior

Oleg Broytman phd at phd.pp.ru
Fri Apr 16 09:31:31 CEST 2010


On Fri, Apr 16, 2010 at 12:57:06AM -0400, Alex Gaynor wrote:
> >>> def f(**kwargs):
> ...     print(kwargs)
> ...
> >>> kwargs = {1: 3}
> >>>
> >>> dict({}, **kwargs)
> {1: 3}
> >>> f(**kwargs)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: f() keywords must be strings

   Argument names must be strings. In your example 1 must be at least '1'.

Oleg.
-- 
     Oleg Broytman            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list