[Python-Dev] Very Strange Argument Handling Behavior
Alex Gaynor
alex.gaynor at gmail.com
Fri Apr 16 06:57:06 CEST 2010
Hi all,
I ran into the follow behavior while making sure Django works
correctly on PyPy. The following behavior was observed in all tested
versions of CPython (2.5, 3.1):
>>> 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
>>>
This behavior seems pretty strange to me, indeed PyPy gives the
TypeError for both attempts. I just wanted to confirm that it was in
fact intentional.
Thanks,
Alex
--
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me
More information about the Python-Dev
mailing list