Reference
Alexander Blinne
news at blinne.net
Tue Mar 4 07:55:39 EST 2014
Am 03.03.2014 19:48, schrieb Terry Reedy:
> The 'is' operator has three uses, two intended and one not. In
> production code, 'is' tests that an object *is* a particular singular
> object, such as None or a sentinel instance of class object.
Just a bit of statistics on this one from a recent small project:
<13:51:20> alex at firefly$ grep ' is ' *.py | wc
65 415 3234
<13:51:35> alex at firefly$ grep ' is None' *.py | wc
43 243 1948
<13:51:40> alex at firefly$ grep ' is not None' *.py | wc
21 167 1241
<13:51:44> alex at firefly$ grep ' is False' *.py | wc
1 5 45
No other uses if 'is' found in almost 3 KLOC...
More information about the Python-list
mailing list