I get KeyError when running following code:
r={'foo':'bar'} #no timestamp
def function(f=None):
    try:
        print(f) # giving r['timestamp'] KeyError
    except:
        print("problem")
function(f=r['timestamp'])
But this is working, it prints problem:
try:
    print(r['timestamp']) # giving r['timestamp'] KeyError
except:
    print("problem")
I can't understand why try-except block is not working in function.
 
     
    