> shows that python doesn't call the __not__ special method > in a 'not' operator statement. Python calls the special __nonzero__ method so check the truth value of an object. > Another question, I notice than "a or b" and "a and b" are > not equivalent to "a | b" and "a & b", since the last ones call > the methods __or__ and __and__ if they are defined, but > the "literal forms" never call them. Is this intentional?, if > that is the case, I guess a big and clear note is needed > in the documentation. "and" and "or" are logical operators, while "|" and "&" are bitwise operators. >>> 13 & 14 12 >>> 13 and 14 14 > And just for symmetry considerations, given that python has the > pairs (and, &) and (or, |), does anybody considering to introduce > the ! operator, so you can have the equivalent (not, !) too? There is a bitwise not operator: ~ >>> ~2 -3 Cheers, Brian
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