是否可以取消python 2.6中的“关键字参数重复”异常?

是否可以取消python 2.6中的“关键字参数重复”异常?,python,python-2.6,Python,Python 2.6,代码在Python2.5上运行,但在2.6上出现此异常时失败。该异常是源代码中的语法错误,修复此异常的唯一方法是更正函数调用 Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f(x): pass ... >>>

代码在Python2.5上运行,但在2.6上出现此异常时失败。该异常是源代码中的语法错误,修复此异常的唯一方法是更正函数调用

Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(x): pass
...
>>> f(x=1, x=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'x'
>>> f(x=1, **{'x': 2})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'x'

Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(x): pass
...
>>> f(x=1, x=2)
  File "<stdin>", line 1
SyntaxError: keyword argument repeated
>>> f(x=2, **{'x': 1})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'x'

我会假设这是一个解析时间错误,所以不会。做这件事的代码无论如何都是坏的。