[Python-Dev] TypeError: f() missing 1 required positional argument: 'x'

Steven D'Aprano steve at pearwood.info
Thu Sep 20 21:09:19 CEST 2012

On 21/09/12 01:53, Oscar Benjamin wrote:

> Mark Dickinson wrote:
>>>>> def f(x): pass
>> ...
>>>>> f()
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in<module>
>> TypeError: f() missing 1 required positional argument: 'x'
> I would say that the only problem with this terminology is that it would be
> good to think of a word to replace "keyword-only" (positionless?).

I disagree completely. I think keyword-only is the right terminology to
use for arguments which can only be passed by keyword. It is *positional*
that is questionable, since named positional arguments can be given by

I would like to see error messages reserve the terms:

1) "positional" for explicitly positional-only parameters;
2) "keyword" for explicitly keyword-only parameters;

(I don't mind whether or not they use "-only" as a suffix)

For normal, named-positional-or-keyword arguments, just use an unqualified


More information about the Python-Dev mailing list