best solution to for loop

Mauricio Tellez mauricio.tellez at gmail.com
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
(<http://www.python.org/doc/essays/list2str.html>
http://www.python.org/doc/essays/list2str.html) and perhaps filter() or
something like that could help. Any clue?

--
Mauricio Tellez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050921/73183e38/attachment.html>


More information about the Python-list mailing list