Hi folks,

I have the following loop (actually repeated many times )

def locChoices(self):
        locDS = self.eslocation.getDataSet()
        loc_Choices=['<None>']
        locKeys=[0]
        for row in locDS:
            loc_Choices.append(row['facility'])
            locKeys.append(row['pkid'])

return loc_Choices,locKeys

where locDS is a tuple of dicts and a row is a dict.

Since I use a lot of similar loops to populate many dropdown controls I started investigating the use of list comprehensions.  But I can't figure out how to use them in this loop and wonder if it will improve the performance.  The data is not very big - about a thousand rows - give or take.

So what do you guys think?


Johnf



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to