Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion TypeError: f() missing 1 required positional argument: 'x'

Received: by 10.180.98.234 with SMTP id el10mr801069wib.3.1348167084732;
        Thu, 20 Sep 2012 11:51:24 -0700 (PDT)
X-BeenThere: dev-python@googlegroups.com
Received: by 10.180.90.134 with SMTP id bw6ls1573244wib.1.canary; Thu, 20 Sep
 2012 11:51:24 -0700 (PDT)
Received: by 10.180.75.8 with SMTP id y8mr999166wiv.4.1348167084501;
        Thu, 20 Sep 2012 11:51:24 -0700 (PDT)
Received: by 10.180.75.8 with SMTP id y8mr999165wiv.4.1348167084489;
        Thu, 20 Sep 2012 11:51:24 -0700 (PDT)
Return-Path: <python-dev-bounces+dev-python+garchive-30976=googlegroups....@python.org>
Received: from mail.python.org (mail.python.org. [82.94.164.166])
        by gmr-mx.google.com with ESMTPS id cx9si671638wib.0.2012.09.20.11.51.24
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 20 Sep 2012 11:51:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of python-dev-bounces+dev-python+garchive-30976=googlegroups....@python.org designates 82.94.164.166 as permitted sender) client-ip=82.94.164.166;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of python-dev-bounces+dev-python+garchive-30976=googlegroups....@python.org designates 82.94.164.166 as permitted sender) smtp.mail=python-dev-bounces+dev-python+garchive-30976=googlegroups....@python.org; dkim=pass header...@python.org
Received: from albatross.python.org (localhost [127.0.0.1])
	by mail.python.org (Postfix) with ESMTP id 3XN6V40phKzQj5
	for <dev-python+garchive-30976@googlegroups.com>; Thu, 20 Sep 2012 20:51:24 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901;
	t=1348167084; bh=/H83mkEVr8J8/KVlWP+NF5YOT11Xvi91OeaIRiHvQ5E=;
	h=Message-ID:Date:From:MIME-Version:To:References:In-Reply-To:
	 Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:
	 List-Subscribe:Content-Transfer-Encoding:Content-Type:Sender;
	b=T8/Ijv9fTFzU84Ds1IhCO1vA45FAzP6yVy9TPrnHSx3VplPeC7NBK8Kdy+ZFflP/N
	 ShtcfE3uuslSoc2w1o1FcKn4Ujq+WC6hapiblM2XtBuOD4+TchREnr+89bttO0+mLc
	 FWJlgYvsYxyylZYDJnCFZ9nuIxKX0DOaVtVGtu44=
X-Original-To: python-...@python.org
Delivered-To: python-...@mail.python.org
Received: from albatross.python.org (localhost [127.0.0.1])
	by mail.python.org (Postfix) with ESMTP id 3XN6ST25gdzQc1
	for <python-...@python.org>; Thu, 20 Sep 2012 20:50:01 +0200 (CEST)
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03;
	'argument': 0.04; 'subject:Python': 0.05; "'a'": 0.07;
	'arguments': 0.07; 'subject:missing': 0.07; 'argument:': 0.09;
	'imply': 0.09; 'incorrect': 0.09; 'positional': 0.09; 'sep': 0.09;
	'typeerror:': 0.09; 'def': 0.10; '(but': 0.15; "'b'": 0.16;
	'argument.': 0.16; 'b):': 0.16; 'dropping': 0.16;
	'from:addr:steve': 0.16; 'missing,': 0.16; 'naive': 0.16; 'nick':
	0.16; 'received:adl2.internode.on.net': 0.16;
	'received:internode.on.net': 0.16;
	'received:ipmail06.adl2.internode.on.net': 0.16;
	'received:lns20.mel4.internode.on.net': 0.16;
	'received:mel4.internode.on.net': 0.16; 'received:on.net': 0.16;
	'subject:Dev': 0.16; 'subject:required': 0.16; 'verbose': 0.16;
	'yes;': 0.16; 'wrote:': 0.17; 'thu,': 0.17; '>>>': 0.18;
	'subject:] ': 0.19; '"",': 0.22; 'dropped': 0.22; 'pass': 0.25;
	'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26;
	'(most': 0.27; 'steven': 0.29; "skip:' 10": 0.30; 'call.': 0.30;
	'keyword': 0.30; 'function': 0.30; 'error': 0.30; 'expect': 0.31;
	'file': 0.32; 'message.': 0.33; 'impression': 0.33; 'traceback':
	0.33; 'problem': 0.33; 'agree': 0.34; 'acceptable': 0.35; 'pm,':
	0.35; 'but': 0.36; 'too': 0.36; 'skip:p 20': 0.36; 'does': 0.37;
	'far': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'mean': 0.38;
	'to:addr:python.org': 0.39; 'subject:-': 0.40; 'think': 0.40;
	'remove': 0.61; 'more': 0.63; '20,': 0.65; 'message).': 0.84;
	'resolved.': 0.91; 'catalog': 0.93; 'received:118': 0.93
Received: from localhost (HELO mail.python.org) (127.0.0.1)
	by albatross.python.org with SMTP; 20 Sep 2012 20:50:01 +0200
Received: from ipmail06.adl2.internode.on.net (ipmail06.adl2.internode.on.net
	[IPv6:2001:44b8:8060:ff02:300:1:2:6])
	by mail.python.org (Postfix) with ESMTP
	for <python-...@python.org>; Thu, 20 Sep 2012 20:50:00 +0200 (CEST)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Aj4SAFpkW1B20QxNgWdsb2JhbABFhguocY4vJAEBFiYngiABAQUjFR4zCxgCAgUUDQICDwIQGB4TBgIBAYdtAw6nLokZDYlTgSGJGWKDIoIOgRIDjT2GUocpDIU3iAM
Received: from ppp118-209-12-77.lns20.mel4.internode.on.net (HELO
	pearwood.info) ([118.209.12.77])
	by ipmail06.adl2.internode.on.net with ESMTP; 21 Sep 2012 04:19:51 +0930
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
	by pearwood.info (Postfix) with ESMTP id B576A120492
	for <python-...@python.org>; Fri, 21 Sep 2012 04:49:46 +1000 (EST)
Message-ID: <505B654A.90...@pearwood.info>
Date: Fri, 21 Sep 2012 04:49:46 +1000
From: Steven D'Aprano <st...@pearwood.info>
User-Agent: Mozilla/5.0 (X11; Linux i686;
	rv:10.0.6esrpre) Gecko/20120717 Thunderbird/10.0.6
MIME-Version: 1.0
To: python-...@python.org
References: <CAAu3qLUDriU=t+pOX9WWW5JYego1xz=0izBoh-Kg5tMivPu...@mail.gmail.com>
	<CADiSq7fERUAZNe17i=mKa7LzAyNq0yvuwTAN3FVJYG-gZHP...@mail.gmail.com>
	<CAAu3qLXHOs8G4LtxJ6q=TE5NfQ-sRquom88CzCXmzhfVK+O...@mail.gmail.com>
In-Reply-To: <CAAu3qLXHOs8G4LtxJ6q=TE5NfQ-sRquom88CzCXmzhfVK+O...@mail.gmail.com>
Subject: Re: [Python-Dev] TypeError: f() missing 1 required positional
 argument: 'x'
X-BeenThere: python-...@python.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Python core developers <python-dev.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/options/python-dev>,
	<mailto:python-dev-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-dev/>
List-Post: <mailto:python-...@python.org>
List-Help: <mailto:python-dev-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-dev>,
	<mailto:python-dev-requ...@python.org?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: python-dev-bounces+dev-python+garchive-30976=googlegroups....@python.org
Sender: "Python-Dev"
	<python-dev-bounces+dev-python+garchive-30976=googlegroups....@python.org>

On 20/09/12 22:59, Mark Dickinson wrote:
> On Thu, Sep 20, 2012 at 1:21 PM, Nick Coghlan<ncogh...@gmail.com>  wrote:
>> +1 for using the unqualified "argument" in these error messages to
>> mean "positional or keyword argument" (inspect.Parameter spells it out
>> as POSITIONAL_OR_KEYWORD, but the full phrase is far too verbose for
>> an error message).
>
> Ah yes;  I see that 'positional or keyword' is a more accurate term
> (but agree it's unwieldy for an error message).  I also see that I was
> naive to think that the 'fix' is as simple as dropping the word
> 'positional':
>
>      >>>  def f(a, *, b):
>      ...     pass
>      ...
>      >>>  f()
>      Traceback (most recent call last):
>        File "<stdin>", line 1, in<module>
>      TypeError: f() missing 1 required positional argument: 'a'
>
> If the word 'positional' were dropped here, it would give the
> incorrect impression that f only requires one argument.


I don't expect error messages to give a complete catalog of every
problem with a specific function call. If f() reports that required
argument 'a' is missing, that does not imply that no other required
arguments are also missing. I think it is perfectly acceptable to
not report the missing 'b' until the missing 'a' is resolved.

But I do expect error messages to be accurate. +1 to remove the
word "positional" from the message.



-- 
Steven
_______________________________________________
Python-Dev mailing list
Python-...@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/dev-python%2Bgarchive-30976%40googlegroups.com