In Python 3, you can define a function that accepts "required keyword-only arguments". This is most clearly described in PEP 3102 . The error message that you get when you omit the required arguments for a keyword only contains the argument names.
$ python3 Python 3.5.2rc1 (default, Jun 13 2016, 09:33:26) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> class X: ... def __init__(self, *, foo, bar, baz): ... self.foo = foo ... self.bar = bar ... self.baz = baz ... >>> a = X(foo=1,bar=2,baz=3) # no error >>> b = X(foo=1,bar=2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() missing 1 required keyword-only argument: 'baz' >>> b = X(foo=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() missing 2 required keyword-only arguments: 'bar' and 'baz'
However, this is incompatible with code that expects to be able to call X() with positional arguments, and the error message you get is still what you don't like:
>>> a = X(1,2,3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() takes 1 positional argument but 4 were given
Additionally, this feature is not available in any version of Python 2:
$ python Python 2.7.12rc1 (default, Jun 13 2016, 09:20:59) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class X(object): ... def __init__(self, *, foo, bar, baz): File "<stdin>", line 2 def __init__(self, *, foo, bar, baz): ^ SyntaxError: invalid syntax
Improving the diagnostics provided for positional arguments is likely to require hacking the interpreter. The Python development team may be fixable; I would consider how to do this on the python-ideas mailing list.