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


Groups > comp.lang.python > #82075

Re: Python Iterables struggling using map() built-in

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
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.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'args': 0.07; 'layers': 0.07; 'subject:using': 0.09; 'empty.': 0.16; 'iteration.': 0.16; 'other,': 0.16; 'raised,': 0.16; 'thought.': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'example': 0.22; 'instead.': 0.24; '&gt;': 0.26; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'quite': 0.32; 'received:google.com': 0.35; 'should': 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'making': 0.63; 'more': 0.64; 'note:': 0.66; 'confusing': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=IUiFRPIyts5mUITVnH48N0tts1FFV6LvPzowsDgQFaU=; b=Nx3VysRCVsPMdvNXOFl6yq4662bV3sYn2wphTcozsPTNDqL7AVWRTD6boZbBKybKtB sV7ht/a9Igoljbu+D0mYrW+Eg69XoDMeySPLTgPbK+pmjo2TguE4KsA8sAUKMbSHbigf HMdYB8Aqs6Qf/x+ZUbgzzTpn0JXma1zHnpoc8J0RhSh9jAx4lVdE/kRtWiGGDXyIwQWB rs9vFJMxj8H1Qg0rngHUVS4MW1CgRDL6Kw6K0NzP6iBh7yplcoq2hxvKgOJDRgc/e2Qy /WKaCbzdrzWPo/uxqMIaOHJncnBH+scM0Lv/Xm98F1N+/XwTrUg21P1ezG6zOo0eO+DM WWJw==
MIME-Version 1.0
X-Received by 10.70.43.68 with SMTP id u4mr14550938pdl.6.1417976827755; Sun, 07 Dec 2014 10:27:07 -0800 (PST)
In-Reply-To <m61roh$i5m$1@ger.gmane.org>
References <004e01d01173$e1641c10$a42c5430$@gmail.com> <m61roh$i5m$1@ger.gmane.org>
Date Sun, 7 Dec 2014 11:27:07 -0700
Subject Re: Python Iterables struggling using map() built-in
From Ian Kelly <ian.g.kelly@gmail.com>
To Python <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7bd9018e1e44900509a475e9
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.16684.1417976836.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417976836 news.xs4all.nl 2961 [2001:888:2000:d::a6]:43756
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82075

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Dec 7, 2014 8:31 AM, "Ned Batchelder" <ned@nedbatchelder.com> wrote:
> NOTE: THIS EXAMPLE IS HORRIBLE.  This code is crazy-confusing, and should
never have been used as an example of iteration. It layers at least three
iterations on top of each other, making it very difficult to see what is
going on.  It uses "while iters" where "while True" would do exactly the
same thing (iters will never be false).

That's not quite correct; the "while iters" actually guards against the
case where the passed args are empty. With no sub-iterators, no
StopIteration would ever be raised, and the result would be an infinite
generator of empty tuples. The "while iters" makes it return immediately
instead.

So it seems this example is even more confusing than you thought.

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


Thread

Re: Python Iterables struggling using map() built-in Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-07 11:27 -0700

csiph-web