a = 1
b = 2
c = a if a > b else b
print(c)
print(id(c))
print(id(b))
条件为真返回前面的为假返回后面的
a = 0 b = 2 c = a or b print(c) print(id(c)) print(id(b))
返回不为0的
a = 0 b = 0 c = a or b print(c) print(id(c)) print(id(b))
返回0
a = 1 b = 2 c = a or b print(c) print(id(c)) print(id(a))
返回or前面的
a = 0 b = None c = a or b print(c) print(id(c)) print(id(a))
为None或0返回or后面的