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
c = 'no'
d = 'nono'
print '3', c, d
foo(c, d)
print '4', c, d
3 no nono 1 no nono 1.6 maybe 2 yes yes yes 4 maybe nono
import datetime
def goo(a=datetime.datetime.now):
try:
b = a()
except TypeError:
b = a
print 'a is', repr(a), 'b is', b
goo()
a is <built-in method now of type object at 0xb726e8a0> b is 2014-11-08 10:51:35.073836
goo('world')
a is 'world' b is world
goo(5)
a is 5 b is 5
goo({'hello': 'world'})
a is {'hello': 'world'} b is {'hello': 'world'}