Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16863

Re: Misleading error message of the day

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'raises': 0.07; 'stuff,': 0.07; 'variable,': 0.07; 'args,': 0.09; 'bug?': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'raised.': 0.09; 'received:gator410.hostgator.com': 0.09; 'tuple': 0.09; 'valueerror:': 0.09; '~ethan~': 0.09; 'subject:error': 0.09; '"...': 0.16; '"expected': 0.16; '14",': 0.16; 'benjamin': 0.16; 'iterable,': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'rhs': 0.16; 'roy': 0.16; 'unpack': 0.16; 'unpacking': 0.16; 'very,': 0.16; 'cc:addr:python- list': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.20; 'long,': 0.21; 'so.': 0.22; 'dec': 0.22; "doesn't": 0.22; 'header :In-Reply-To:1': 0.22; 'items.': 0.23; 'cc:2**0': 0.24; 'function': 0.27; 'variable': 0.28; 'lists': 0.28; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'values': 0.32; 'returning': 0.32; 'thu,': 0.32; 'header:User-Agent:1': 0.33; 'instead': 0.33; 'there': 0.33; 'probably': 0.34; 'too': 0.34; 'things': 0.34; 'supposed': 0.35; 'but': 0.37; 'list,': 0.37; 'could': 0.37; "it's": 0.40; 'more': 0.61; '2011': 0.61; 'stop': 0.63; 'received:websitewelcome.com': 0.64; 'received:184': 0.67; 'received:69.93': 0.67; 'subject:day': 0.68; 'received:gateway15.websitewelcome.com': 0.84; 'received:69.93.164': 0.91
Date Thu, 08 Dec 2011 11:09:23 -0800
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version 1.0
To Benjamin Kaplan <benjamin.kaplan@case.edu>
Subject Re: Misleading error message of the day
References <roy-9DEDD9.09233308122011@news.panix.com> <jbqil6$esn$1@dough.gmane.org> <mailman.3417.1323357938.27778.python-list@python.org> <18647617.2258.1323358966076.JavaMail.geo-discussion-forums@yqf20> <mailman.3421.1323359453.27778.python-list@python.org> <3164448.1087.1323369765528.JavaMail.geo-discussion-forums@yqcm37> <CAMuTYXhG-+CVm1BC5TKr2ektgPN1KC2BnbLXMy+X_Z-GrWMotg@mail.gmail.com>
In-Reply-To <CAMuTYXhG-+CVm1BC5TKr2ektgPN1KC2BnbLXMy+X_Z-GrWMotg@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:3084
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3444.1323372966.27778.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323372966 news.xs4all.nl 6900 [2001:888:2000:d::a6]:40004
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16863

Show key headers only | View raw


Benjamin Kaplan wrote:
> On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith <roy@panix.com> wrote:
>> (some,
>>  very,
>>  long,
>>  list,
>>  of,
>>  variable,
>>  names,
>>  to,
>>  get,
>>  the,
>>  stuff,
>>  unpacked,
>>  into) = function_that_should_return_a_14_tuple()
>>
>> raises
>>
>> ValueError: too many values to unpack
>>
>> Quick, what's the bug?  Did I forget a variable on the LHS, or is my function returning more things than it should?  I know it's supposed to be 14, but I don't know which side is wrong.  Had it said "... expected 13, got 14", I would know immediately.
>>
> 
> If the RHS was a tuple or a list, yes you could know immediately. But
> unpacking works with any iterable, so it probably doesn't special-case
> lists and tuples. Iterables don't have a size- they just keep going
> until StopIteration is raised. So in EVERY SINGLE CASE, you would get
> "expected n args, got n+1" even if the iterable would return 24 items
> instead of 14, or would never stop returning items.

Not so.  There could be fewer, in which you could see "expected 13 args, 
got 7."

~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 09:23 -0500
  Re: Misleading error message of the day Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-08 14:39 +0000
  Re: Misleading error message of the day Chris Angelico <rosuav@gmail.com> - 2011-12-09 01:40 +1100
  Re: Misleading error message of the day Robert Kern <robert.kern@gmail.com> - 2011-12-08 14:47 +0000
    Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 07:30 -0800
      Re: Misleading error message of the day Tim Chase <python.list@tim.thechases.com> - 2011-12-08 11:41 -0600
    Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 07:30 -0800
  Re: Misleading error message of the day Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-08 16:03 +0100
    Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 07:33 -0800
      Re: Misleading error message of the day Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-08 20:49 +0100
      Re: Misleading error message of the day Ethan Furman <ethan@stoneleaf.us> - 2011-12-08 12:13 -0800
      Re: Misleading error message of the day Lie Ryan <lie.1296@gmail.com> - 2011-12-09 12:46 +1100
        Re: Misleading error message of the day alex23 <wuwei23@gmail.com> - 2011-12-08 20:57 -0800
          Re: Misleading error message of the day Lie Ryan <lie.1296@gmail.com> - 2011-12-11 10:41 +1100
      Re: Misleading error message of the day Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-09 11:03 +0100
        Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-09 09:43 -0500
      Re: Misleading error message of the day Ethan Furman <ethan@stoneleaf.us> - 2011-12-09 09:39 -0800
    Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 07:33 -0800
      Re: Misleading error message of the day Grant Edwards <invalid@invalid.invalid> - 2011-12-08 18:10 +0000
        Re: Misleading error message of the day alister <alister.ware@ntlworld.com> - 2011-12-08 20:58 +0000
          Re: Misleading error message of the day Chris Angelico <rosuav@gmail.com> - 2011-12-09 08:17 +1100
        Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 20:19 -0500
        Re: Misleading error message of the day Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-09 02:07 +0000
          Re: Misleading error message of the day Chris Angelico <rosuav@gmail.com> - 2011-12-09 14:46 +1100
            Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 23:44 -0500
  Re: Misleading error message of the day Heiko Wundram <modelnine@modelnine.org> - 2011-12-08 16:16 +0100
    Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 07:42 -0800
      Re: Misleading error message of the day Heiko Wundram <modelnine@modelnine.org> - 2011-12-08 16:50 +0100
        Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 10:42 -0800
          Re: Misleading error message of the day Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-12-08 13:57 -0500
          Re: Misleading error message of the day Ethan Furman <ethan@stoneleaf.us> - 2011-12-08 11:09 -0800
          Re: Misleading error message of the day Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-12-08 14:38 -0500
          Re: Misleading error message of the day Ethan Furman <ethan@stoneleaf.us> - 2011-12-08 12:09 -0800
        Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 10:42 -0800
      Re: Misleading error message of the day Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-08 15:55 +0000
      Re: Misleading error message of the day Chris Angelico <rosuav@gmail.com> - 2011-12-09 03:21 +1100
      Re: Misleading error message of the day Robert Kern <robert.kern@gmail.com> - 2011-12-08 19:57 +0000
    Re: Misleading error message of the day Roy Smith <roy@panix.com> - 2011-12-08 07:42 -0800

csiph-web