Tim Peters wrote: > [Michael Foord] >>> ... >>> Adding the following new asserts: >>> >>> ... >>> assertNotIs (first, second, msg=None) > > [Steve Holden] >> Please, let's call this one "assertIsNot". > > +1 > >> I know it's valid Python to say >> >> if a not is b: > > Nope, that's a syntax error. > Rats, naturally I was thinking of "if not (a is b):" >> but it's a much less natural way of expressing the condition, and (for all I >> know) might even introduce an extra negation operation. "is not" is, I >> believe, treated as a single operator. > > "is not" and "not in" are both binary infix operators, not to be > confused with the distinct use of "not" on its own as a unary prefix > operator. "not is" and "in not" are both gibberish. > >>>> 1 is not 2 > True >>>> 1 is (not 2) > False >>>> 1 not is 2 > SyntaxError: invalid syntax > >>>> 1 not in [2] > True >>>> 1 in not [2] > SyntaxError: invalid syntax >>>> 1 in (not [2]) > Traceback (most recent call last): > ... > TypeError: argument of type 'bool' is not iterable regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4