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


Groups > comp.lang.python > #7018

Re: Lambda question

Path csiph.com!x330-a1.tempe.blueboxinc.net!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 <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:libero.it': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:libero.it': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'def': 0.12; 'skip:[ 20': 0.12; 'wrote:': 0.14; 'subject:question': 0.23; 'equal': 0.31; 'header:X -Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'list': 0.33; 'header:User-Agent:1': 0.35; 'received:org': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'received:151': 0.67
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it>
Subject Re: Lambda question
Followup-To gmane.comp.python.general
Date Sat, 04 Jun 2011 21:34:50 +0200
References <20110604174624.V8FO6.213264.root@cdptpa-web07-z02>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host ppp-71-50.26-151.libero.it
User-Agent KNode/4.4.11
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.2457.1307216114.9059.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 82.94.164.166
X-Trace 1307216114 news.xs4all.nl 49044 [::ffff:82.94.164.166]:57172
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7018

Followups directed to: gmane.comp.python.general

Show key headers only | View raw


jyoung79@kc.rr.com wrote:

> I was surfing around looking for a way to split a list into equal
> sections.

non-recursive, same-unreadeable (worse?) one liner alternative:

def chunks(s, j):
    return [''.join(filter(None,c))for c in map(None,*(s[i::j]for i in 
range(j)))]


-- 
By ZeD

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


Thread

Re: Lambda question Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it> - 2011-06-04 21:34 +0200

csiph-web