Skip to content

Instantly share code, notes, and snippets.

@skatenerd
Last active August 29, 2015 14:01
Show Gist options
  • Save skatenerd/1e4fef1d42a3b7e3c4dc to your computer and use it in GitHub Desktop.
Save skatenerd/1e4fef1d42a3b7e3c4dc to your computer and use it in GitHub Desktop.
item getter
input = [(1,2), (3,4)]
expected_output = [2,4]
def first_way(input):
def get_second_thing(tuple):
return tuple[1]
return map(get_second_thing, input)
def second_way(input):
return map(operator.itemgetter(1), input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment