Skip to content

Instantly share code, notes, and snippets.

@kentquirk
Created September 10, 2016 19:26
Show Gist options
  • Save kentquirk/fc565b2d3cc11981e4d2d27e0c2e462c to your computer and use it in GitHub Desktop.
Save kentquirk/fc565b2d3cc11981e4d2d27e0c2e462c to your computer and use it in GitHub Desktop.
Python one-liner broken down
# broken down for "readability"
output = dict(
[
(o, [e["pet"] for e in input if e["owner"] == o])
for o in
set([i["owner"] for i in input])
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment