Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104163
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: reversed(zip(...)) not working as intended |
| Date | Sun, 6 Mar 2016 12:38:50 -0600 |
| Lines | 31 |
| Message-ID | <mailman.261.1457289721.20602.python-list@python.org> (permalink) |
| References | <56DC7727.1090001@mail.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de mN4ttKm8/z5el08jp5VQ0gdUeCXYVVd9pQ5r+xg+1MGQ== |
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python3': 0.05; 'raises': 0.07; '(0,': 0.09; '(1,': 0.09; 'falls': 0.09; 'typeerror:': 0.09; 'python': 0.10; 'subject:not': 0.11; 'argument': 0.15; '(2,': 0.16; '(3,': 0.16; '(8,': 0.16; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'received:10.215': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reversed': 0.16; 'sequence.': 0.16; 'wrote:': 0.16; '>>>': 0.20; '"",': 0.22; '2.x': 0.22; '(most': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'linux': 0.26; 'sequence': 0.27; "i'm": 0.30; 'related': 0.32; 'returned': 0.32; 'traceback': 0.33; 'file': 0.34; 'handle': 0.34; "isn't": 0.35; 'but': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'charset:us- ascii': 0.37; 'why': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'strange': 0.63; 'more': 0.63; 'mar': 0.65; 'received:10.235': 0.84; 'received:23': 0.84; '2014,': 0.91 |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-Sender-Id | wwwh|x-authuser|tim@thechases.com |
| X-MC-Relay | Neutral |
| X-MailChannels-SenderId | wwwh|x-authuser|tim@thechases.com |
| X-MailChannels-Auth-Id | wwwh |
| X-MC-Loop-Signature | 1457289710161:203292336 |
| X-MC-Ingress-Time | 1457289710161 |
| In-Reply-To | <56DC7727.1090001@mail.de> |
| X-Mailer | Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) |
| X-AuthUser | tim@thechases.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:104163 |
Show key headers only | View raw
On 2016-03-06 19:29, Sven R. Kunze wrote: > what's the reason that reversed(zip(...)) raises as a TypeError? > > Would allowing reversed to handle zip and related functions lead to > strange errors? Peculiar, as this works in 2.x but falls over in 3.x: $ python Python 2.7.9 (default, Mar 1 2015, 12:57:24) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> list(reversed(zip(range(10), range(20,100)))) [(9, 29), (8, 28), (7, 27), (6, 26), (5, 25), (4, 24), (3, 23), (2, 22), (1, 21), (0, 20)] $ python3 Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> list(reversed(zip(range(10), range(20,100)))) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: argument to reversed() must be a sequence I'm not sure why reversed() doesn't think that the thing returned by zip() isn't a sequence. -tkc
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: reversed(zip(...)) not working as intended Tim Chase <python.list@tim.thechases.com> - 2016-03-06 12:38 -0600
csiph-web