Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104820
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Simple exercise |
| Date | Mon, 14 Mar 2016 09:16:59 -0600 |
| Lines | 29 |
| Message-ID | <mailman.102.1457968662.12893.python-list@python.org> (permalink) |
| References | <mailman.117.1457600573.15725.python-list@python.org> <nbt1vd$k00$1@dont-email.me> <mailman.163.1457659326.15725.python-list@python.org> <nbt7qr$4fa$1@dont-email.me> <mailman.167.1457661831.15725.python-list@python.org> <88c5b5fa-66a0-461a-8ae4-b3264b32f679@googlegroups.com> <CAHVvXxTAy=Ey7-+eLWwyjZXwwOn0_ay-i5-=trTRBQpKE19zZw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de Giqa7u4QwQ4WDIH/Hn4AqgmBDOotw9z3hkYxcN4nUzZQ== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'reason,': 0.07; 'cc:addr :python-list': 0.09; 'benjamin': 0.09; 'length.': 0.09; 'lengths': 0.09; 'warn': 0.09; 'exception': 0.13; 'index': 0.13; 'useful,': 0.13; '2016': 0.16; 'cc:name:python list': 0.16; 'dropping': 0.16; 'iterables': 0.16; 'iterator': 0.16; 'length,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'x).': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'meant': 0.22; 'pass': 0.22; 'am,': 0.23; 'advance.': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; "i've": 0.25; 'example': 0.26; 'rest': 0.26; 'error': 0.27; 'equivalent': 0.27; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'function': 0.28; 'values': 0.28; 'strongly': 0.30; 'anyone': 0.32; 'items.': 0.33; 'raised': 0.33; 'subject:Simple': 0.33; 'though.': 0.33; 'received:google.com': 0.35; 'something': 0.35; 'item': 0.35; 'sometimes': 0.35; 'received:209.85': 0.36; 'possible': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'johnson': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'or,': 0.38; 'rather': 0.39; 'avoid': 0.61; 'march': 0.64; 'mar': 0.65; 'else.': 0.66; 'matter.': 0.66; 'percent': 0.66; 'hoping': 0.77; 'oscar': 0.84; 'absolutely': 0.88; 'to:none': 0.91; 'rick': 0.93; 'hundred': 0.96 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=kYu7XCad5GhFX0tNEolNP+CA+jIh8sErmNR4rjw6brE=; b=XyXOHj/djaRN5SF9fn8kEkM+1qzoo8iZGJzCE0z+3NvE0NxGy4E1GXiKrnXpmrI18q RyJKiui546/8GUKBuMlauEy3dEuZNgH6qqB1S1IfwK5Wz724+vo1TXslmmXaTkeqP+6E xs6ogK8XSs2QgMAqgv1iWJuNm9hUsVK6CfYOMvtiZJaPsK14A0gdgXgaPaJM7CGTOqMg 2tGR9+Py1MH2XkqrLSKZtPx8+a6hYPAHgLIlquZrP1dl6eIm7mC8Uh0YUOqEaOn952Yh sEbuzFvbK/vjH+CPieDCbshvhYAGOj495Nva+3E8Ca2wcRQhUn6O/rmDfoodFJ78ir36 f7SQ== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=kYu7XCad5GhFX0tNEolNP+CA+jIh8sErmNR4rjw6brE=; b=l3SvYbFbJug2q+hgIU9ykiuwi/+R3xCrEReOTFob1NXr2wrELx4bGRaS6w/43FquZ3 H8uF9rCAoeSto8bGmP0ApGgwRQOtsMlGPsn1tadU3Jy5Wy08F4KmMiC55eAXbhfYr0P2 aX1HZP5K0WyeaRyMQrPT+8jbp4dFPoPWkEiKZs70PkxB4ITZci6T1GXK4CuUaQSfWUXG m5p5HaVhFVLu+Mv4mFF0Eo1yYJIXWUatGK6pN4q1lPq03YXWUKVM47H3onOUaQ70od2A l3sxfW0BJWI2PIoyyBvnFwAlPoT4c5e8y2HcZzTpNabNPk+y7HoayfZPNh/zJ6UztvYF c2wg== |
| X-Gm-Message-State | AD7BkJIt9X4aDN4x4ICcQ1sz7saMWFtYEVr0Z3n+WZ66jZYODmHDBgRas4whWoOFRh2+lQLh27qGeFgg8Lr3Ug== |
| X-Received | by 10.50.112.10 with SMTP id im10mr18339711igb.93.1457968659189; Mon, 14 Mar 2016 08:17:39 -0700 (PDT) |
| In-Reply-To | <CAHVvXxTAy=Ey7-+eLWwyjZXwwOn0_ay-i5-=trTRBQpKE19zZw@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:104820 |
Show key headers only | View raw
On Mon, Mar 14, 2016 at 9:06 AM, Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote: > On 14 March 2016 at 14:35, Rick Johnson <rantingrickjohnson@gmail.com> wrote: >> >> I would strongly warn anyone against using the zip function >> unless > ... >> I meant to say: absolutely, one hundred percent *SURE*, that >> both sequences are of the same length, or, absolutely one >> hundred percent *SURE*, that dropping values is not going to >> matter. For that reason, i avoid the zip function like the >> plague. I would much rather get an index error, than let an >> error pass silently. > > I also think it's unfortunate that zip silently discards items. Almost > always when I use zip I would prefer to see an error when the two > iterables are not of the same length. It's sometimes very useful, though. For example on multiple occasions I've taken advantage of the fact that enumerate(x) is equivalent to zip(itertools.count(), x). If zip raised an error then that would only be possible using islice, and then only if the length is known in advance. Also, in order for zip to know that the lengths are not equal, it would have to try to read one additional item from the longer iterable. That's rather unfortunate if it's an iterator and you're hoping to catch the exception and then use the rest of the iterator for something else.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Simple exercise Rodrick Brown <rodrick.brown@gmail.com> - 2016-03-10 04:02 -0500
Re: Simple exercise Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-10 11:30 +0100
Re: Simple exercise Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-10 12:07 +0100
Re: Simple exercise Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-10 17:05 +0100
Re: Simple exercise Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-10 17:08 +0100
Re: Simple exercise Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-03-11 12:24 +1300
Re: Simple exercise Chris Angelico <rosuav@gmail.com> - 2016-03-11 10:38 +1100
Re: Simple exercise BartC <bc@freeuk.com> - 2016-03-11 00:05 +0000
Re: Simple exercise Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-11 01:21 +0000
Re: Simple exercise BartC <bc@freeuk.com> - 2016-03-11 01:45 +0000
Re: Simple exercise Larry Martell <larry.martell@gmail.com> - 2016-03-10 20:53 -0500
Re: Simple exercise "Martin A. Brown" <martin@linux-ip.net> - 2016-03-10 17:56 -0800
Re: Simple exercise Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-11 02:03 +0000
Re: Simple exercise BartC <bc@freeuk.com> - 2016-03-11 02:18 +0000
Re: Simple exercise Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 07:35 -0700
Re: Simple exercise Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-03-14 15:06 +0000
Re: Simple exercise Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 09:00 -0700
Re: Simple exercise Steven D'Aprano <steve@pearwood.info> - 2016-03-15 10:59 +1100
Re: Simple exercise Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-15 07:26 +0200
Re: Simple exercise Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-03-15 19:39 +1100
Re: Simple exercise Chris Angelico <rosuav@gmail.com> - 2016-03-15 19:53 +1100
Re: Simple exercise Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-15 11:04 +0200
Re: Simple exercise Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2016-03-15 11:09 +0000
Re: Simple exercise Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-14 09:16 -0600
Re: Simple exercise Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 09:11 -0700
Re: Simple exercise Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-14 15:23 +0000
Re: Simple exercise Peter Otten <__peter__@web.de> - 2016-03-14 17:00 +0100
Re: Simple exercise Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-11 02:05 +0000
Re: Simple exercise Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 07:07 -0700
Re: Simple exercise Larry Martell <larry.martell@gmail.com> - 2016-03-14 10:13 -0400
Re: Simple exercise alister <alister.ware@ntlworld.com> - 2016-03-14 14:18 +0000
Re: Simple exercise Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-14 08:22 -0700
Re: Simple exercise MRAB <python@mrabarnett.plus.com> - 2016-03-14 15:57 +0000
Re: Simple exercise Chris Kaynor <ckaynor@zindagigames.com> - 2016-03-10 18:14 -0800
Re: Simple exercise boffi <boffi@casa.sua> - 2016-03-17 22:28 +0100
csiph-web