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


Groups > comp.lang.python > #58258 > unrolled thread

Re: "Backward"-Iterator - Beginners question

Started byChris Angelico <rosuav@gmail.com>
First post2013-11-01 22:55 +1100
Last post2013-11-01 20:09 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: "Backward"-Iterator - Beginners question Chris Angelico <rosuav@gmail.com> - 2013-11-01 22:55 +1100
    Re: "Backward"-Iterator - Beginners question patrick vrijlandt <patrick.vrijlandt@gmail.com> - 2013-11-01 20:09 +0000

#58258 — Re: "Backward"-Iterator - Beginners question

FromChris Angelico <rosuav@gmail.com>
Date2013-11-01 22:55 +1100
SubjectRe: "Backward"-Iterator - Beginners question
Message-ID<mailman.1920.1383306910.18130.python-list@python.org>
On Fri, Nov 1, 2013 at 9:18 PM, Ulrich Goebel <ml@fam-goebel.de> 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

[toc] | [next] | [standalone]


#58288

Frompatrick vrijlandt <patrick.vrijlandt@gmail.com>
Date2013-11-01 20:09 +0000
Message-ID<40007371405028839.607061patrick.vrijlandt-gmail.com@newszilla.xs4all.nl>
In reply to#58258
Chris Angelico <rosuav@gmail.com> wrote:
> On Fri, Nov 1, 2013 at 9:18 PM, Ulrich Goebel <ml@fam-goebel.de> 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.

Well, if you want to iterate over a SQL result backwards, I would seriously
consider modifying the SELECT to yield the results in the right order. That
would avoid keeping the list in memory and makes best use of the database.


-- 
patrick

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web