KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to provide a function as the default argument for the dictionary's get function, like this def run(): print "RUNNING" test = {'store':1} test.get('store', run()) However, when this is run, it displays the following output: RUNNING 1 so my question is, as the title says, is there a way to provide a callable as the default value for the get method without it being called if the key exists?
Tags (comma-separated)
Save Edits
Cancel