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


Groups > comp.lang.python > #82075 > unrolled thread

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

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2014-12-07 11:27 -0700
Last post2014-12-07 11:27 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-12-07 11:27 -0700
SubjectRe: Python Iterables struggling using map() built-in
Message-ID<mailman.16684.1417976836.18130.python-list@python.org>

[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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web