[issue9943] TypeError message became less helpful in Python 2.7

Geoffrey Bache report at bugs.python.org
Fri Sep 24 21:44:19 CEST 2010


New submission from Geoffrey Bache <gjb1002 at users.sourceforge.net>:

Consider the following code:

### keywords.py

def f(**kw):
    print arg, kw

f("hello", keyword=True)

and compare the behaviour in Python 2.6 and Python 2.7:

$ python keywords.py 
Traceback (most recent call last):
  File "keywords.py", line 5, in <module>
    f("hello", keyword=True)
TypeError: f() takes exactly 0 non-keyword arguments (1 given)

$ python2.7 keywords.py
Traceback (most recent call last):
  File "keywords.py", line 5, in <module>
    f("hello", keyword=True)
TypeError: f() takes exactly 0 arguments (2 given)

The error message from 2.6 is I would say a more accurate description of the situation.

----------
components: Interpreter Core
messages: 117327
nosy: gjb1002
priority: normal
severity: normal
status: open
title: TypeError message became less helpful in Python 2.7
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9943>
_______________________________________


More information about the Python-bugs-list mailing list