python not is函数_python操作符,没有操作符“not in”怎么处理?
你可能會發(fā)現(xiàn)以下函數(shù)和反匯編有助于理解操作符:>>> def test():
if 0 in (): pass
if 0 not in (): pass
if 0 is (): pass
if 0 is not (): pass
return None
>>> dis.dis(test)
2 0 LOAD_CONST 1 (0)
3 LOAD_CONST 2 (())
6 COMPARE_OP 6 (in)
9 POP_JUMP_IF_FALSE 15
12 JUMP_FORWARD 0 (to 15)
3 >> 15 LOAD_CONST 1 (0)
18 LOAD_CONST 3 (())
21 COMPARE_OP 7 (not in)
24 POP_JUMP_IF_FALSE 30
27 JUMP_FORWARD 0 (to 30)
4 >> 30 LOAD_CONST 1 (0)
33 LOAD_CONST 4 (())
36 COMPARE_OP 8 (is)
39 POP_JUMP_IF_FALSE 45
42 JUMP_FORWARD 0 (to 45)
5 >> 45 LOAD_CONST 1 (0)
48 LOAD_CONST 5 (())
51 COMPARE_OP 9 (is not)
54 POP_JUMP_IF_FALSE 60
57 JUMP_FORWARD 0 (to 60)
6 >> 60 LOAD_CONST 0 (None)
63 RETURN_VALUE
>>>
總結(jié)
以上是生活随笔為你收集整理的python not is函数_python操作符,没有操作符“not in”怎么处理?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python 常见函数_Python基础
- 下一篇: 怎么重装显卡驱动 重装显卡驱动的步骤