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


Groups > comp.lang.python > #80992

Re: Different behaviour in list comps and generator expressions

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
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; 'causing': 0.04; 'expressions': 0.07; 'dan': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'raises': 0.09; '~ethan~': 0.09; 'eagerness': 0.16; 'filename:fname piece:signature': 0.16; 'inclined': 0.16; 'subject:Different': 0.16; 'subject:expressions': 0.16; 'subject:generator': 0.16; 'thereby': 0.16; 'eager': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; "i'm": 0.30; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'opposed': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'detail': 0.37; 'list': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'itself': 0.39; 'to:addr:python.org': 0.39; 'impact': 0.61; 'received:173': 0.61; 'simply': 0.61; 'different.': 0.84
Date Mon, 17 Nov 2014 18:20:00 -0800
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Different behaviour in list comps and generator expressions
References <545d76fe$0$12980$c3e8da3$5496439d@news.astraweb.com> <546a8524$0$12990$c3e8da3$5496439d@news.astraweb.com> <CAGGBd_o6t0y2KnTjp-x9O6fpj_RV2JqG09kxGoPkC5tWwbxutA@mail.gmail.com>
In-Reply-To <CAGGBd_o6t0y2KnTjp-x9O6fpj_RV2JqG09kxGoPkC5tWwbxutA@mail.gmail.com>
Content-Type multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="g9MgQEb7032uxDqlbIxH9gIjlHkIU0OB3"
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.15966.1416277211.18130.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416277211 news.xs4all.nl 2915 [2001:888:2000:d::a6]:35205
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80992

Show key headers only | View raw


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

On 11/17/2014 03:38 PM, Dan Stromberg wrote:
> 
> I'm inclined to say that list comprehensions and generator expressions
> should be different.  I don't really think they should be identical,
> one being eager and one being lazy.  Why let the implementation detail
> of one impact the other?

It's not the eagerness vs. laziness that's being changed, but rather what happens in a generator when something inside
the generator raises StopIteration (as opposed to the generator itself simply return'ing and thereby causing a
StopIteration to be generated).

--
~Ethan~

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


Thread

Different behaviour in list comps and generator expressions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-08 12:50 +1100
  Re: Different behaviour in list comps and generator expressions Roy Smith <roy@panix.com> - 2014-11-07 23:39 -0500
  Re: Different behaviour in list comps and generator expressions Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-11-08 22:31 +0100
  Re: Different behaviour in list comps and generator expressions Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-11-08 23:42 +0100
  Re: Different behaviour in list comps and generator expressions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-18 10:30 +1100
    Re: Different behaviour in list comps and generator expressions Dan Stromberg <drsalists@gmail.com> - 2014-11-17 15:38 -0800
    Re: Different behaviour in list comps and generator expressions Ethan Furman <ethan@stoneleaf.us> - 2014-11-17 18:20 -0800

csiph-web