EX.is not ...is (not ...)

This commit is contained in:
暮晨 2018-11-14 23:59:59 +08:00 committed by 暮晨
parent c44269e302
commit 638bd16f02

View File

@ -34,7 +34,7 @@ So, here we go...
- [> `is` is not what it is!/出人意料的`is`!](#-is-is-not-what-it-is出人意料的is)
- [> A tic-tac-toe where X wins in the first attempt!/一蹴即至!](#-a-tic-tac-toe-where-x-wins-in-the-first-attempt一蹴即至)
- [> The sticky output function/麻烦的输出](#-the-sticky-output-function麻烦的输出)
- [> `is not ...` is not `is (not ...)`](#-is-not--is-not-is-not-)
- [> `is not ...` is not `is (not ...)`/`is not ...` 不是 `is (not ...)`](#-is-not--is-not-is-not-is-not--不是-is-not-)
- [> The surprising comma](#-the-surprising-comma)
- [> Backslashes at the end of string](#-backslashes-at-the-end-of-string)
- [> not knot!](#-not-knot)
@ -608,7 +608,7 @@ funcs_results = [func() for func in funcs]
---
### > `is not ...` is not `is (not ...)`
### > `is not ...` is not `is (not ...)`/`is not ...` 不是 `is (not ...)`
```py
>>> 'something' is not None
@ -617,10 +617,10 @@ True
False
```
#### 💡 Explanation
#### 💡 说明:
- `is not` is a single binary operator, and has behavior different than using `is` and `not` separated.
- `is not` evaluates to `False` if the variables on either side of the operator point to the same object and `True` otherwise.
- `is not` 是个单独的二元运算符, 与分别使用 `is``not` 不同.
- 如果操作符两侧的变量指向同一个对象, 则 `is not` 的结果为 `False`, 否则结果为 `True`.
---