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


Groups > comp.lang.python > #32662

Re: Haskell -> Python

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.05; 'case.': 0.05; 'python': 0.09; 'preferable': 0.09; 'def': 0.10; '3.3,': 0.16; '[x]': 0.16; 'heap': 0.16; 'syntax.': 0.16; 'wrote:': 0.17; 'yield': 0.17; 'latter': 0.22; 'header:In-Reply- To:1': 0.25; 'looks': 0.26; 'message-id:@mail.gmail.com': 0.27; 'tail': 0.29; 'fri,': 0.30; 'received:209.85.215.46': 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; 'think': 0.40; 'more': 0.63; 'fact,': 0.69; '(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=6/KizKquHBQj4WV+4gl/UIHx2d1ocw8dIAIypmV4I2w=; b=cHBS/ZiK22fBGiELrr3q+jDKTxps5U8JHP0MR/TDW+blqpvk3GO4ayVxMYuVWWA4DY bFRSJYzVprePkP6GvjU7FsYwqO/uoO/KKDo8M0ILXqdHiH5NiwVPI0qcOR/47x7KrZof D83DELmf9y6uugJUL97aZrWxUpjpmP9UbwgcUTyAsaRcQz9723jRs8/ghuqvEdXdWqex baJKT8ZqHmsJawOBN8I3oPAb9KRHe7sUWmRUMf85OQK5AQQcjmOtjHWt2DDIEpXPIyRj u4FmVUPRRHB+KmMYv3RTCAjCWFpYdauqUvGsQLb3iyRiF4do2IywXWa7yV7T51uaGO2R YP3Q==
MIME-Version 1.0
In-Reply-To <CALwzidmH0OE5qvKByraHtFTKj7qUSQwEqs=QNhngek54i=dxGw@mail.gmail.com>
References <b19e3922-d86f-426f-afb8-1f75b793f87b@googlegroups.com> <CALwzidmH0OE5qvKByraHtFTKj7qUSQwEqs=QNhngek54i=dxGw@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 2 Nov 2012 15:46:45 -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.3223.1351892837.27098.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351892837 news.xs4all.nl 6925 [2001:888:2000:d::a6]:53307
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32662

Show key headers only | View raw


On Fri, Nov 2, 2012 at 3:40 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> 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

In fact, the more that I look at it, the more that I think the latter
might be preferable in any case.

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


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