Created
April 24, 2020 21:05
-
-
Save cosinekitty/eeca70dcc6f824db6783211740a49098 to your computer and use it in GitHub Desktop.
Illustration of why the Tally function's use of a default argument is broken.
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
| GlobalCount = {} | |
| def Tally(text, count = GlobalCount): | |
| for c in text: | |
| count[c] = 1 + count.get(c, 0) | |
| return count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment