Created
January 25, 2011 23:45
-
-
Save wwitzel3/795949 to your computer and use it in GitHub Desktop.
Is this a horrible idea?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class Booltring(object): | |
... def __nonzero__(self): | |
... return False | |
... def __str__(self): | |
... return 'X' | |
... | |
>>> b = Booltring() | |
>>> bool(b) | |
False | |
>>> print b | |
X | |
>>> if b: | |
... print b | |
... | |
>>> if not b: | |
... print b | |
... | |
X | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment