Last active
April 19, 2020 01:29
-
-
Save y56/77028293d50f7f48fbdce26c66301779 to your computer and use it in GitHub Desktop.
collections.defaultdict(int) collections.defaultdict(lambda: 0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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