Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32595
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.024 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'alter': 0.09; "(it's": 0.16; 'branch:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'traverse': 0.16; 'wrote:': 0.17; 'element': 0.17; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'fri,': 0.30; 'function.': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'nov': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=TetkROgGbu53Zkfrw1jyCK5zWXB9Zn23sTTRcSBBukI=; b=hm3uiieFkrlovHsgQ+zzOPxA7qtMwNAhwAftwj5XJ+VVauN4zaJKqE8RQyCU/oA4PY erxb85qNfrH10xG29a9fivQ1Oihrsa12gMwY/FZLsHMSu5ma8DzUT8ouwPVTh3XC16zy MpiGr1TgUIfVDaSS4bVDdzAtP74TxmUdanvlOdAsqNgRPiwDYoqRHgQAw4PnepLwR99E skvISBpDMZwMXrFaQjEAUaVpGzKUaEJp+oAdnMTlHxtEjNWdf/US9IT2+rq046BpEIRD QCB96U6wLNTT9noplIUB/K9Z0GjGz+Vbmzt6rFpMXkGW+x19/NKGkdRFTbq0umxHmLdq 0LIw== |
| MIME-Version | 1.0 |
| In-Reply-To | <BLU0-SMTP321F0666E2573FA6807D728F3670@phx.gbl> |
| References | <CAFqGZREfq7fO4Okf1Oj9HBeUkWLYK_9=ho8N47_kyTKudGZSFA@mail.gmail.com> <CANaSqUfRdHoeUzcmAsmaK2WBgbXH63ZDu0pg2ebEX8APKkNwaw@mail.gmail.com> <BLU0-SMTP321F0666E2573FA6807D728F3670@phx.gbl> |
| Date | Fri, 2 Nov 2012 18:56:33 +1100 |
| Subject | Re: pythonic way |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| 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.3178.1351842997.27098.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351842997 news.xs4all.nl 6959 [2001:888:2000:d::a6]:43709 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32595 |
Show key headers only | View raw
On Fri, Nov 2, 2012 at 6:14 PM, jack <naruto0.1@live.cn> wrote: > Sometimes, I need to alter the element as traverse a list like this (it's a > sample): > c = range(10) > i = 0 > for ele in c: > # do something > # branch: > c[i] = # value > i += 1 > > How to be pythonic? Check out the enumerate() function. ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: pythonic way Chris Angelico <rosuav@gmail.com> - 2012-11-02 18:56 +1100
csiph-web