The and operator of Python's evaluation expression seems to be evaluated from the left side expression

Is it okay to write code that depends on this ...

>>> 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

Recommended Posts

The and operator of Python's evaluation expression seems to be evaluated from the left side expression
Capture GeneratorExit and detect the end of iteration from the generator side
I wanted to be careful about the behavior of Python's default arguments
Specify the start and end positions of files to be included with qiitap
The place to be evaluated may be different between map and list comprehension notation
Change the decimal point of logging from, to.
From the introduction of pyethapp to the execution of contract
The story of moving from Pipenv to Poetry
Extract images and tables from pdf with python to reduce the burden of reporting
The story of porting code from C to Go and getting hooked (and to the language spec)
It seems that the module of train_test_split changes from 0.20, and Deprecation Warning appears at 0.18.
In matplotlib, set the vertical axis on the left side of the histogram to frequency and the vertical axis on the right side to relative frequency (maybe a wicked way)
What seems to be a template of the standard input part of the competition pro in python3
[Python] A program to find the number of apples and oranges that can be harvested