Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7031
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jackdied@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'python': 0.08; 'pm,': 0.10; 'syntax': 0.11; 'def': 0.12; 'wrote:': 0.14; 'library': 0.15; '**kwargs):': 0.16; 'generators.': 0.16; 'cc:addr:python- list': 0.17; 'simpler': 0.19; 'yet.': 0.19; 'header:In-Reply- To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'gregory': 0.23; '(and': 0.25; 'message-id:@mail.gmail.com': 0.28; 'sat,': 0.29; 'import': 0.29; 'lists': 0.29; 'instead': 0.29; 'cc:addr:python.org': 0.30; 'can.': 0.30; 'ewing': 0.30; "can't": 0.32; 'patch': 0.32; 'proposed': 0.32; 'steven': 0.32; 'list': 0.33; "d'aprano": 0.35; 'replacement': 0.35; 'idea': 0.36; 'received:google.com': 0.37; 'received:74.125.82': 0.38; 'received:74.125': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'easier': 0.39; "i'd": 0.39; 'more': 0.60; 'your': 0.60; 'piece': 0.63; 'promise': 0.72 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JTvEQgNnYYyqQSHByJ0Gmwa14+PP2tnzFv07FvxqYBw=; b=gbmwX+nMsmOqmfk/WW4/avQjkIi/cTIhnW3ew/6k/D8GLMW+dvsHA6mcmMC9GJZ1ml WJfGkNIx6dqKmqH7LKl9AZ8rSHylGzmx01bSMW04oT+BgOVdkTdbxXRHG9d0EQeD7HCn rchn5tlQIqaFQHIJwUrXEBRhqMNjOSXCh0MU0= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=eHy6xusBDpvCnD+CE9YyhLVP5rt7tlZpu/xA0fY0lmsYhUZOw1tjKrL2yJNiPne+06 JFTVZw8UblQ+qvVEyyf9Rlbvg2joUl3WbdmIK7P77cluQwpTvwfYrNrJggt8IdggPHeu D8Td/+LfUEaW+qCkfmNQ/B6VDoFJ4WQ+sViBs= |
| MIME-Version | 1.0 |
| In-Reply-To | <95059eFuroU1@mid.individual.net> |
| References | <4dea7932$0$28716$607ed4bc@cv.net> <4dead453$0$29996$c3e8da3$5496439d@news.astraweb.com> <95059eFuroU1@mid.individual.net> |
| Date | Sat, 4 Jun 2011 22:06:30 -0400 |
| Subject | Re: Generator Frustration |
| From | Jack Diederich <jackdied@gmail.com> |
| To | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2462.1307239599.9059.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1307239600 news.xs4all.nl 49176 [::ffff:82.94.164.166]:34274 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7031 |
Show key headers only | View raw
On Sat, Jun 4, 2011 at 9:43 PM, Gregory Ewing
<greg.ewing@canterbury.ac.nz> wrote:
> Steven D'Aprano wrote:
>
>> A nice piece of syntax that has been proposed for Python is "yield from",
>> which will do the same thing, but you can't use that yet.
You can also patch the library to always return lists instead of generators.
def seriously_I_just_want_lists(func):
def replacement(*args, **kwargs):
return list(func(*args, **kwargs))
return replacement
import otherlib
otherlib.somefunc = seriously_I_just_want_lists(otherlib.somefunc)
But I'd avoid it where you can. While the idea of a list is simpler
than the idea of an iterable (and easier to get your head around)
iterables promise less and that makes them more flexible and easier to
composite.
-Jack
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Generator Frustration "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2011-06-04 14:27 -0400
Re: Generator Frustration Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-05 00:56 +0000
Re: Generator Frustration Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-05 13:43 +1200
Re: Generator Frustration Jack Diederich <jackdied@gmail.com> - 2011-06-04 22:06 -0400
Re: Generator Frustration "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2011-06-05 20:11 -0400
Re: Generator Frustration Jan Decaluwe <jan@jandecaluwe.com> - 2011-06-05 11:52 +0200
Re: Generator Frustration Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-06-06 11:07 +0200
Re: Generator Frustration "TommyVee" <xxxxxxxx@xxxxxx.xxx> - 2011-06-07 20:41 -0400
csiph-web