Skip to content

Instantly share code, notes, and snippets.

@tinnet
Created January 18, 2013 13:26
Show Gist options
  • Save tinnet/4564533 to your computer and use it in GitHub Desktop.
Save tinnet/4564533 to your computer and use it in GitHub Desktop.
def wrap_list_in_result_dict(entities, page=1, total_pages=1, num_results=None):
return dict(
entities=entities,
page=page,
total_pages=total_pages,
num_results=num_results or len(entities))
# this is the entire list
print wrap_list_in_result_dict([1,2,3,4])
# this is a part, but i know how many there are
print wrap_list_in_result_dict([1,2,3,4], 1, 1, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment