演示断言

#演示断言
#!/usr/local/bin/python2.5
def f(x):
	assert x < 1,'x must >= 1'
	return x**2
print f(1)

编程技巧