Skip to content

Instantly share code, notes, and snippets.

@y56
Last active April 19, 2020 01:29
Show Gist options
  • Save y56/77028293d50f7f48fbdce26c66301779 to your computer and use it in GitHub Desktop.
Save y56/77028293d50f7f48fbdce26c66301779 to your computer and use it in GitHub Desktop.
collections.defaultdict(int) collections.defaultdict(lambda: 0)
collections.defaultdict(int)
# good
collections.defaultdict(lambda: 0)
# good
collections.defaultdict(lambda x:x**2)
# TypeError: <lambda>() missing 1 required positional argument: 'x'
# it seems program expects function without arguments
# Note that int() gives 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment