def f(x):
	def g():
		return x
	return g

g1, g2 = f(1), f(2)

# Equal code, inequivalent functions
print g1.func_code == g2.func_code
print g1.func_code.co_code == g2.func_code.co_code
print g1() == g2()

print

def f(x):
    y = x**2 + 1
    return y

def g(x):
    a = x**2
    b = a + 1
    return b

# Unequal code, equivalent functions
print f.func_code == g.func_code
print f.func_code.co_code == g.func_code.co_code

print

def f():
	return 1

def g():
	return 2

# Just to show that comparing co_code in particular is extremely wrong.

print f.func_code.co_code == g.func_code.co_code