2008/9/17 Che M <[EMAIL PROTECTED]>:
>> (heck, you could select code, start, style form codes -- pull all the
>> information you need in a single query, and skip the loop
>> altogether..)
> I think I need the loop because the style will be multiple styles and
> I need to take the codes that go with each style, so I am querying
> style by style, so to speak.

What I meant is that you could do this:

cur.execute("select code, start, style from codes where code != '' and
start > ? and start <= ?", #etc)
results = cur.fetchall()
self.style_data_dict = {}
for code, start, style in results:
  self.style_data_dict.setdefault(style, []).append((code, start))

This will leave your data dict in a different form from the one in
your original code.. but you could change it by:

for style in self.style_data_dict:
  self.style_data_dict[style] = zip(*self.style_data_dict[style])

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to