Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25167
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <fetchinson@googlemail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.162 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.70; '*S*': 0.02; 'subject:skip:c 10': 0.07; 'received:mail-qc0-f174.google.com': 0.09; 'funcs': 0.16; 'lambda': 0.16; 'simplest': 0.16; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'print': 0.32; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'from:addr:googlemail.com': 0.35; 'received:209.85': 0.35; 'does': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'more': 0.63; 'importantly,': 0.65; 'down!': 0.84; 'to:name:python': 0.84; 'why?': 0.84; 'subject:funny': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SOglRru7upYq+yM14kLx4wjoAFbMBLvzdO3+RiBT1KI=; b=VrT3e1J/RPhoFfmrL8aGWWqbEgGGLB4BsJy1+4+ImewLiXJ+tRMcaebwYtRaCLvFXh HmbBFtzjEL7Gaeu6fQ1faqkfmRzaVxLwQlBUzLytE5qKTlO8ClYZX7KWDWj3jOUHw6wq WFpNXelqLnHtSl20sozcrlIRtAShFdLjo9KJEtYBPZaldRmz6utVS7BME3cI+V4gmlvB a+UVjyNiPzXTdc19Ekt9rZnm1/JTiKJGBZbFnnBgoqxyCwtEWBIO8T4FltTGmh3WZLNt M9bSkNaVRN8wmY1LYbnkR8WBUptTmCPu0213q0uiCwUrE9EVxxD+M3WwVOzOo82/c2Rm 0Ueg== |
| MIME-Version | 1.0 |
| In-Reply-To | <CADjSo4QvTnGKy_ZYOO5qZu3tSKovwAMGjku4L+RXEkYmwXPz4g@mail.gmail.com> |
| References | <CADjSo4QvTnGKy_ZYOO5qZu3tSKovwAMGjku4L+RXEkYmwXPz4g@mail.gmail.com> |
| Date | Wed, 11 Jul 2012 08:43:11 +0200 |
| Subject | Re: lambda in list comprehension acting funny |
| From | Daniel Fetchinson <fetchinson@googlemail.com> |
| 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.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.2007.1341988993.4697.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1341988993 news.xs4all.nl 6969 [2001:888:2000:d::a6]:33404 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25167 |
Show key headers only | View raw
> funcs = [ lambda x: x**i for i in range( 5 ) ] > print funcs[0]( 2 ) > print funcs[1]( 2 ) > print funcs[2]( 2 ) > > This gives me > > 16 > 16 > 16 > > When I was excepting > > 1 > 2 > 4 > > Does anyone know why? And more importantly, what's the simplest way to achieve the latter? :) -- Psss, psss, put it down! - http://www.cafepress.com/putitdown
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: lambda in list comprehension acting funny Daniel Fetchinson <fetchinson@googlemail.com> - 2012-07-11 08:43 +0200
Re: lambda in list comprehension acting funny Franck Ditter <franck@ditter.org> - 2012-07-12 08:49 +0200
Re: lambda in list comprehension acting funny Alister <alister.ware@ntlworld.com> - 2012-07-12 09:44 +0000
Re: lambda in list comprehension acting funny Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-12 11:29 +0000
Re: lambda in list comprehension acting funny 88888 Dihedral <dihedral88888@googlemail.com> - 2012-07-14 03:31 -0700
csiph-web