Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16868
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'raised': 0.07; '(it': 0.09; 'raised,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'underlying': 0.09; 'subject:error': 0.09; 'am,': 0.12; '(call': 0.16; 'enigma': 0.16; 'iterator': 0.16; 'iterator.': 0.16; 'kern': 0.16; 'swallow': 0.16; 'unpacking': 0.16; 'valueerror': 0.16; 'wrote:': 0.18; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'values.': 0.23; 'times,': 0.24; 'all,': 0.28; 'raise': 0.28; "wasn't": 0.28; 'interpret': 0.29; 'temporary': 0.29; 'pm,': 0.29; 'chris': 0.30; 'values': 0.32; 'list': 0.32; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'object': 0.33; 'fri,': 0.34; 'to:addr:python-list': 0.34; 'too': 0.34; 'but': 0.37; 'could': 0.37; 'received:org': 0.38; 'should': 0.39; 'to:addr:python.org': 0.40; 'more': 0.61; '2011': 0.61; 'back': 0.62; 'world': 0.62; 'received:86': 0.63; 'results': 0.63; 'our': 0.64; 'fall': 0.64; 'believe': 0.65; 'roughly': 0.67; 'subject:day': 0.68; 'informative': 0.73; 'andrea': 0.84; 'yielded': 0.84; 'eco': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: Misleading error message of the day |
| Date | Thu, 08 Dec 2011 19:57:15 +0000 |
| 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> <4EE0DDE4.4080802@gmail.com> <CAPTjJmqg+kti8Hh+oZ4fxzZaPFi6LntJJaawiU3Bz10bentPZQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | cpc24-cmbg15-2-0-cust204.5-4.cable.virginmedia.com |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
| In-Reply-To | <CAPTjJmqg+kti8Hh+oZ4fxzZaPFi6LntJJaawiU3Bz10bentPZQ@mail.gmail.com> |
| 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.3448.1323374249.27778.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323374249 news.xs4all.nl 6941 [2001:888:2000:d::a6]:37553 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16868 |
Show key headers only | View raw
On 12/8/11 4:21 PM, Chris Angelico wrote: > On Fri, Dec 9, 2011 at 2:55 AM, Andrea Crotti<andrea.crotti.0@gmail.com> wrote: >> Yes but how do you know how many values you generated when it quits? >> I mean I don't know how it work internally, but it should keep a temporary >> list of the yielded values to be able to find out how many values are >> there.. > > Iterator unpacking works roughly thus: > > 1) Count up how many results you need (call that N) > 2) N times, get a value from the iterator. If StopIteration is raised, > swallow it and raise ValueError because there were too few values. > 3) Attempt to get one more value from the iterator. If StopIteration > is NOT raised, raise ValueError because there were too many values. > > At no point is the "total size" of the iterator counted (it could, > after all, be infinite). When ValueError is raised, all that's known > is that StopIteration wasn't raised at the end of the process. unpack_iterable() has the original object available to it, not just the iterator. It could opportunistically check for __len__() and fall back to the less informative message when it is absent. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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