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


3 no nono
1 no nono
1.6 maybe
2 yes yes yes
4 maybe nono

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()


a is <built-in method now of type object at 0xb726e8a0> b is 2014-11-08 10:51:35.073836

In [7]:
goo('world')


a is 'world' b is world

In [8]:
goo(5)


a is 5 b is 5

In [9]:
goo({'hello': 'world'})


a is {'hello': 'world'} b is {'hello': 'world'}