Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32661
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!feed.xsnews.nl!border-2.ams.xsnews.nl!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; 'def': 0.10; '3.3,': 0.16; '[x]': 0.16; 'heap': 0.16; 'syntax.': 0.16; 'wrote:': 0.17; 'yield': 0.17; 'cheers,': 0.23; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'message- id:@mail.gmail.com': 0.27; 'tail': 0.29; 'fri,': 0.30; 'could': 0.32; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'nov': 0.35; 'replaced': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'next': 0.35; 'anything': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'more': 0.63; '(head': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=hwlDk3hNwos6v3IpZfeqF6tbUhtLppq/qfLF6cVBUUU=; b=OgJS8LJe+R4A1rWBlXNaJ1TqLf5xGBvBjvJrG8M70jTGso/e1nWq2RLR+600eXTD70 dc700ftaTMQK2edFkvzkf1bSHA8K9Jvh5xvm9lbvrsrXgVw2D8NG/O7uTouPYtbMn6ko Oyv8Aqpy4QLNyqOO/I6g1k1xZEYvLfAl+LcqzoD28pIjz6GBeWC1mBSA92Q3fGXh2zAW z94z6Qky8pewIQcRllVJAAJxftgF/a9jrdA7ypQKyWZhnZwBUZj4DjFRoJJJpmFfRPAc fvoWQcj/DN2f5tMHE4FxWBv9qBljZb6eMVHYD5/3ecsPfSPQIso0aro3QcL1bSLlG1y5 ZMsQ== |
| MIME-Version | 1.0 |
| In-Reply-To | <b19e3922-d86f-426f-afb8-1f75b793f87b@googlegroups.com> |
| References | <b19e3922-d86f-426f-afb8-1f75b793f87b@googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Fri, 2 Nov 2012 15:40:53 -0600 |
| Subject | Re: Haskell -> Python |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 | <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.3222.1351892486.27098.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351892486 news.xs4all.nl 6950 [2001:888:2000:d::a6]:50158 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32661 |
Show key headers only | View raw
On Fri, Nov 2, 2012 at 1:19 PM, <foster63@gmail.com> wrote:
> Is there anything anyone could recommend to make it more "Pythonic" or more functional. It looks clumsy next to the Haskell.
def options(heaps):
for i, heap in enumerate(heaps):
head = heaps[:i]
tail = heaps[i+1:]
yield from (head + [x] + tail for x in range(heap))
"yield from" is Python 3.3 syntax. If you're not using Python 3.3,
then that line could be replaced by:
for x in range(heap):
yield head + [x] + tail
Cheers,
Ian
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Haskell -> Python foster63@gmail.com - 2012-11-02 12:19 -0700
Re: Haskell -> Python Dave Angel <d@davea.name> - 2012-11-02 15:56 -0400
Re: Haskell -> Python Simon Foster <simon.foster@inbox.com> - 2012-11-02 20:09 +0000
Re: Haskell -> Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-02 15:40 -0600
Re: Haskell -> Python Duncan Booth <duncan.booth@invalid.invalid> - 2012-11-03 16:29 +0000
Re: Haskell -> Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-02 15:46 -0600
Re: Haskell -> Python Dave Angel <d@davea.name> - 2012-11-02 18:24 -0400
Re: Haskell -> Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-02 16:27 -0600
Re: Haskell -> Python Dave Angel <d@davea.name> - 2012-11-02 22:03 -0400
Re: Haskell -> Python aahz@pythoncraft.com (Aahz) - 2012-11-03 22:16 -0700
csiph-web