On 24/06/2019 17:15, johnf wrote:

> 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

> ... and wonder if it will improve the performance.  

Because you are building two lists in one loop it
probably won't do much for performance.
It might even be worse. As always measure.

But something else that might make a small
difference is the pre-fetch of the locations.

Why not:

for location in self.eslocation.getDataSet():
    ....

You don't use the locDS value anywhere other
than in the loop.

Also the choice of method name is unfortunate in
that you return both choices and keys but the method
name implies only choices.

Minor nit-picks...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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

Reply via email to