Created
September 28, 2017 10:32
-
-
Save kzar/3b77355ac3f18b14622761fbf4dfe465 to your computer and use it in GitHub Desktop.
Shared default parameter value Python example
This file contains 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
import random | |
def foo(b={}): | |
b[random.random()] = "bar" | |
print b | |
for i in range(10): | |
print "Iteration " + str(i + 1) | |
foo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment