#!/usr/bin/env python # coding: utf-8 # In[1]: def foo(a, b): global c print '1', a, b a = 'yes' b = 'yes yes' #print '1.5', c c = 'maybe' print '1.6', c print '2', a, b # In[2]: c = 'no' d = 'nono' # In[3]: print '3', c, d foo(c, d) print '4', c, d # In[4]: import datetime # In[5]: def goo(a=datetime.datetime.now): try: b = a() except TypeError: b = a print 'a is', repr(a), 'b is', b # In[6]: goo() # In[7]: goo('world') # In[8]: goo(5) # In[9]: goo({'hello': 'world'})