LoginSignup
0
0

More than 5 years have passed since last update.

Pythonの評価式のand演算子は左辺式から評価されるようだ

Posted at

これに依存したコードを書いて良いものでしょうか・・

>>> 1 is None
False

>>> 1 is None and b
False

>>> b and 1 is None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'b' is not defined
0
0
2

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