Created
February 6, 2018 00:51
-
-
Save huseyinyilmaz/445ecfa8edf647deaa1ec26c8190c952 to your computer and use it in GitHub Desktop.
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
from collections import defaultdict | |
def run(): | |
print("RUNNING") | |
return 'val' | |
test = {'store':1} | |
print(test.get('store', run)) | |
print(test.get('not_stored', run)) | |
test2 = defaultdict(run) | |
test2['store'] = 1 | |
print(test2['store']) | |
print(test2['not_stored']) # calls function | |
# output: | |
# 1 | |
# <function run at 0x102877ae8> | |
# 1 | |
# RUNNING | |
# val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment