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


Groups > comp.lang.python > #32669

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 <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; 'cc:addr:python-list': 0.10; '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; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'looks': 0.26; 'tail': 0.29; 'fri,': 0.30; 'could': 0.32; 'anyone': 0.33; 'nov': 0.35; 'replaced': 0.35; 'pm,': 0.35; 'there': 0.35; 'next': 0.35; 'anything': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'more': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; '(head': 0.84
Date Fri, 02 Nov 2012 18:24:57 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1
MIME-Version 1.0
To Ian Kelly <ian.g.kelly@gmail.com>
Subject Re: Haskell -> Python
References <b19e3922-d86f-426f-afb8-1f75b793f87b@googlegroups.com> <CALwzidmH0OE5qvKByraHtFTKj7qUSQwEqs=QNhngek54i=dxGw@mail.gmail.com>
In-Reply-To <CALwzidmH0OE5qvKByraHtFTKj7qUSQwEqs=QNhngek54i=dxGw@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:xPVMg0SbrHwhKryliowKPf3hsmNkn9LNSYr2w7/qxvg Ft8fQFzq9TKE/2wZztisyMKAjv9WpU00LQlJrqc2VqnuGiLgMb 08VRht+hQVWNKKxDV0pcVU2c6b0HQTz8CKxL1BnduCz7Ggbr5c qHnSnYmq73kOJuXNCujA0StZeQVBlb39zwG6obsztoPhv/fWhe zs6eKIMIuZO+mPeTxF2suz9YZFQ6UJN8q0vt59VM4Sft6wgmov sYZVyi0ShQiSYGy+VNwYJq3IOY0D4jcnrUCUG4LJG6d1ych5ws E4xBOh48R1+D6TYCLvAWlfgwC3BmNjS3m7e0YyHNjfJ4h62vw= =
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
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.3225.1351895130.27098.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351895130 news.xs4all.nl 6943 [2001:888:2000:d::a6]:42832
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32669

Show key headers only | View raw


On 11/02/2012 05:40 PM, Ian Kelly 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
>
> Cheers,
> Ian
Perhaps range(heap) should be replaced by  range(len(heap))



-- 

DaveA

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