0
0

More than 1 year has passed since last update.

Python_is演算子

Last updated at Posted at 2021-11-16

is演算子

同じオブジェクトかどうか判定する。
Noneなどの判別によく使用する.

a = 1
b = 1
c = 0
d = a
print(id(a), id(b), id(c), id(d))
print(a is b)
print(a is c)
print(a is not c)

94279174345344 94279174345344 94279174345312 94279174345344
True
False
True

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0