best solution to for loop

Mauricio Tellez mauricio.tellez at
Thu Sep 22 04:55:02 CEST 2005

Hi, I have several apps which connect to a database, fetch some data an put
this into a gtk.TreeStore, but if the result set is 1500 row long, the app
response slowly, how can optimize this? here is an example of what I do:

cur.execute("SELECT * FROM clients")
data = cur.fetchall()

for row in data:
treeStore.append(row[0], row[1], row[4], "Ohio", row[5])

I read Guido's An Optimization Anecdote
(<> and perhaps filter() or
something like that could help. Any clue?

Mauricio Tellez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list