Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'anyway.': 0.05; 'cursor': 0.09; 'iterate': 0.09; 'subject:question': 0.10; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'goebel': 0.16; 'iterator': 0.16; 'sqlite': 0.16; 'index': 0.16; 'wrote:': 0.18; 'solution.': 0.20; 'select': 0.22; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'have,': 0.30; 'message- id:@mail.gmail.com': 0.30; 'gives': 0.31; 'easy,': 0.31; 'object.': 0.31; 'once,': 0.31; 'probably': 0.32; 'fri,': 0.33; 'could': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'data,': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'problems.': 0.60; "you're": 0.61; 'back': 0.62; 'more': 0.64; 'hints': 0.68; 'forth': 0.81; 'good!': 0.84; '2013': 0.98 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; bh=Xza1wpSimf8kY1g7HH+KSjIlwhARggXi69TVLorzkKk=; b=lcEMVB1MRK3Zi59EeOEawnNaf87uPmm9WwbAVZgoQXp5A50dveEc7XF9Zi2He6bZms LV/9IEOT2frVMtNwYM8COS7tPC9uGsm8Y1Ndi2ITT2cvyUpep2E5IlJmSXfpSWKBqQeL OAGcoLWN6S5ZqfTxKTUQeBMFvPBezLYkGPdj3IJdfd/KwqVWkFJiERr1AQiMgHlb7Qer iENYOY6B4t2pLj0KAFgKXZPzPCA4QWWR5BuZLe2fjYCJYrK939G7r1OCiWfoILSg0Su8 T2FmNG5kNcWZU9/PtQP9zuOKBgS3cIuhHyBHVjuDwleqPEngmXyfazpDDpB5mETt0vl5 Xu7Q== MIME-Version: 1.0 X-Received: by 10.66.26.236 with SMTP id o12mr2848743pag.136.1383306900468; Fri, 01 Nov 2013 04:55:00 -0700 (PDT) In-Reply-To: <52737FDF.6080306@fam-goebel.de> References: <5272CBA8.3070800@fam-goebel.de> <52737FDF.6080306@fam-goebel.de> Date: Fri, 1 Nov 2013 22:55:00 +1100 Subject: Re: "Backward"-Iterator - Beginners question From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383306910 news.xs4all.nl 15903 [2001:888:2000:d::a6]:54914 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58258 On Fri, Nov 1, 2013 at 9:18 PM, Ulrich Goebel wrote: > That gives me the solution. What I have, is an iterator object comming as a > SQLite database cursor object. So I could minimize the underliying SELECT > and build index = list(cursor). Then with Your hints I get what I want. Looks good! If you need to iterate over something more than once, or go back and forth through it a bit, this is probably the best general solution anyway. With a list, heaps of things are easy, and unless you're working with gobs of data, you won't have any problems. ChrisA