在以下情况下:
test = False test = "" test = 0test = 0.0 test = []test = () test = {} test = set()该
if测试将有所不同:
if test: #Falseif test is not None: #True
之所以如此,是因为
is测试身份,含义
test is not None
相当于
id(test) == id(None) #False
因此
(test is not None) is (id(test) != id(None)) #True



