Skip to content

Instantly share code, notes, and snippets.

@ChadSki
Created October 16, 2013 18:28
Show Gist options
  • Save ChadSki/7012482 to your computer and use it in GitHub Desktop.
Save ChadSki/7012482 to your computer and use it in GitHub Desktop.
List Comprehensions
index_entries = []
for i in range(index_header.tag_count):
ie = IndexEntry(
FileAccess(
IndexEntry.struct_size * i + index_location,
IndexEntry.struct_size),
map_magic,
halomap)
index_entries.append(ie)
# vs
index_entries = [IndexEntry(
FileAccess(
IndexEntry.struct_size * i + index_location,
IndexEntry.struct_size),
map_magic,
halomap) for i in range(index_header.tag_count)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment