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


Groups > comp.lang.python > #8105

Re: Better way to iterate over indices?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; '21,': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'billy': 0.16; 'clunky.': 0.16; 'tue,': 0.17; 'header:In-Reply-To:1': 0.21; 'seems': 0.21; 'received:209.85.161.46': 0.23; 'received:mail- fx0-f46.google.com': 0.23; 'received:209.85.161': 0.26; 'message- id:@mail.gmail.com': 0.28; 'subject:?': 0.29; 'to:addr:python- list': 0.33; 'received:google.com': 0.37; 'received:209.85': 0.37; 'could': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'subject:over': 0.84; 'not:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=4UXhIysD8LHSISIi32raf3xIjFYuUKaA+0/QYvjG7qg=; b=vyCJA/LWVDUyk3iiHLSGmzd9ymUbLXxx7yFK16dVHFKfWXW6z8rnrCmfIK9UJw81Zj Ovz/T4jmC6zstphMu21NvmPpoi5DZVP75xpWn81pykXygOBu+dOYz2lIRSp+QveFWyWf e1XLoN2Rz9bGb4UJkNOFYMdKKAQ6vAVqcFL0A=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=wsOvDzLE3RLEVre8tszjIhuz6lBJPvgFjmBNvbg5bmWzDStji83DLidEUJ/M4Zk0+D 5UKYbgBgDQOgG+K5ZZJZV6SendRCgh1ZIxx0OmRl14OP75uTghcWnnpK3Ew0zMfLBxPG paV187xAScEwJu+QuvfgNAu7v5fgU2+a3Czg4=
MIME-Version 1.0
In-Reply-To <itqmkb$h56$1@speranza.aioe.org>
References <itqmkb$h56$1@speranza.aioe.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 21 Jun 2011 12:15:25 -0600
Subject Re: Better way to iterate over indices?
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 <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.231.1308680156.1164.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 82.94.164.166
X-Trace 1308680156 news.xs4all.nl 49044 [::ffff:82.94.164.166]:43799
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8105

Show key headers only | View raw


On Tue, Jun 21, 2011 at 12:05 PM, Billy Mays <noway@nohow.com> wrote:
> I know I could use enumerate:
>
> for i, v in enumerate(myList):
>    doStuff(i, myList[i])
>
> ...but that stiff seems clunky.

Why not:

for i, v in enumerate(myList):
    doStuff(i, v)

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


Thread

Better way to iterate over indices? Billy Mays <noway@nohow.com> - 2011-06-21 14:05 -0400
  Re: Better way to iterate over indices? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-21 12:15 -0600
  Re: Better way to iterate over indices? Noah Hall <enalicho@gmail.com> - 2011-06-21 19:19 +0100
  Re: Better way to iterate over indices? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-21 11:20 -0700
  Re: Better way to iterate over indices? Ethan Furman <ethan@stoneleaf.us> - 2011-06-21 11:35 -0700

csiph-web