I missed the link djidjadji added. Thanks for the explanation !
..fredrik On 8 jun 2010, at 13.45, Jan Michael Ibanez wrote: > > On Jun 8, 2010, at 7:38 PM, Fredrik Bonander wrote: > >> Real nice, thanks! Defiantly a great improvement. >> >> 2 questions. >> >> 1. Could you elaborate what these lines does? >> >> labelItems = db.get([Label.item.get_value_for_datastore(label) for label in >> labelsData ]) > > db.get() can accept a list of keys to fetch; if it does, it returns a list of > entities matching those keys. > > The parameter to db.get() is a list comprehension; it creates a list of keys > of the item from each label. This allows you to get a list of keys of all the > items of all the labels you fetched. > > >> for label,labelItem in zip(labelsData,labelItems): > > zip(l1, l2) creates a list of tuples. Each element of the list is a tuple, > with the first element of the tuple being an element in the first list, and > the second element being the corresponding element in the second list. See > http://docs.python.org/library/functions.html . The for loop unpacks through > the list of tuples, matching labels to the fetched item for that label. > > Jan Michael Ibanez > [email protected] > > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- Fredrik Bonander [email protected] +46 70 943 5441 - the infinite power of the creative mind - -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
