Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created June 23, 2010 16:20
Show Gist options
  • Save Arachnid/450152 to your computer and use it in GitHub Desktop.
Save Arachnid/450152 to your computer and use it in GitHub Desktop.
def batch_get_lists(lists):
key_set = set()
for l in lists:
key_set.update(l)
all_keys = list(key_set)
all_entities = db.get(all_keys)
entity_dict = dict(zip(all_keys, all_entities))
return [[entity_dict[x] for x in l] for l in lists]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment