Skip to content

Instantly share code, notes, and snippets.

@shicky
Created July 11, 2016 03:04
Show Gist options
  • Save shicky/5eccdb84a48220eb83acad9b104568f4 to your computer and use it in GitHub Desktop.
Save shicky/5eccdb84a48220eb83acad9b104568f4 to your computer and use it in GitHub Desktop.
Initialize Python Double Dict with -1
from collections import defaultdict
d = defaultdict(lambda: defaultdict(lambda: -1))
print(d[544][465]) # should be -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment