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!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'happen,': 0.07; 'python': 0.08; '(it': 0.09; 'differing': 0.09; 'am,': 0.13; 'received:209.85.214.174': 0.13; 'received:mail- iw0-f174.google.com': 0.13; 'wrote:': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lambda': 0.16; 'edward': 0.16; 'meant': 0.17; 'header:In-Reply-To:1': 0.22; 'assume': 0.23; 'code': 0.24; "i'm": 0.27; 'fri,': 0.28; 'received:209.85.214': 0.28; 'message-id:@mail.gmail.com': 0.28; 'elements': 0.29; 'lists': 0.29; "won't": 0.32; 'chris': 0.32; 'done': 0.33; 'to:addr:python-list': 0.34; 'however,': 0.34; '\xa0\xa0\xa0': 0.34; 'functions.': 0.37; 'subject:Please': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'two': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'your': 0.60; 'regexps': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=DOe9WLO4h+69nQQNowS+5xTGCDF/U3a/2JYazx9j8F8=; b=mloImxGakwF8JAEUGby2j9ZchskJXa98fMiKaG5Zb2x9NhDL6s80hHyJt1nbXqNsqd AkwvUrH43L8yl0l5qkcETDYelP67034mvt7pbRDsdbfH3SDkaGcXruVzVndjkNLzi1VQ tAFY6QT5IUgVcqR0ns74PKgrYtDwQ7o/kreDc= MIME-Version: 1.0 In-Reply-To: <77AE044B1BF3944FAE2435F395F11B4B01859CD7@clt-exmb02.bbtnet.com> References: <77AE044B1BF3944FAE2435F395F11B4B01859CD7@clt-exmb02.bbtnet.com> Date: Fri, 15 Jul 2011 16:36:32 +1000 Subject: Re: Please critique my script From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310711795 news.xs4all.nl 23854 [2001:888:2000:d::a6]:33644 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9510 On Fri, Jul 15, 2011 at 4:03 AM, Ellerbee, Edward wr= ote: > for makenewlist in range(0,count): > =A0=A0=A0 sortlist.append(npalist.pop(0) + nxxlist.pop(0)) This can alternatively be done with map(): sortlist =3D map(lambda x,y: x+y, npalist, nxxlist) However, I'm not sure what your code is meant to do if the two lists have differing numbers of elements (if the two regexps turn up differing numbers of results). If you can assume that this won't happen, the simple map call will do the job. (It would have been a lot cleaner if Python exposed its operators as functions. In Pike, that lambda would simply be `+ (backtick-plus).) Chris Angelico