|
@@ 849-874 (lines=26) @@
|
| 846 |
|
__nonzero__ = __bool__ = lambda s: True |
| 847 |
|
|
| 848 |
|
|
| 849 |
|
class _FALSE(BaseElement): |
| 850 |
|
""" |
| 851 |
|
Boolean base element FALSE. |
| 852 |
|
Not meant to be subclassed nor instantiated directly. |
| 853 |
|
""" |
| 854 |
|
|
| 855 |
|
def __init__(self): |
| 856 |
|
super(_FALSE, self).__init__() |
| 857 |
|
# assigned at singleton creation: self.dual = TRUE |
| 858 |
|
|
| 859 |
|
def __hash__(self): |
| 860 |
|
return hash(False) |
| 861 |
|
|
| 862 |
|
def __eq__(self, other): |
| 863 |
|
return self is other or other is False or isinstance(other, _FALSE) |
| 864 |
|
|
| 865 |
|
def __str__(self): |
| 866 |
|
return '0' |
| 867 |
|
|
| 868 |
|
def __repr__(self): |
| 869 |
|
return 'FALSE' |
| 870 |
|
|
| 871 |
|
def __call__(self): |
| 872 |
|
return self |
| 873 |
|
|
| 874 |
|
__nonzero__ = __bool__ = lambda s: False |
| 875 |
|
|
| 876 |
|
|
| 877 |
|
class Symbol(Expression): |
|
@@ 821-846 (lines=26) @@
|
| 818 |
|
return (' ' * indent) + repr(self) |
| 819 |
|
|
| 820 |
|
|
| 821 |
|
class _TRUE(BaseElement): |
| 822 |
|
""" |
| 823 |
|
Boolean base element TRUE. |
| 824 |
|
Not meant to be subclassed nor instantiated directly. |
| 825 |
|
""" |
| 826 |
|
|
| 827 |
|
def __init__(self): |
| 828 |
|
super(_TRUE, self).__init__() |
| 829 |
|
# assigned at singleton creation: self.dual = FALSE |
| 830 |
|
|
| 831 |
|
def __hash__(self): |
| 832 |
|
return hash(True) |
| 833 |
|
|
| 834 |
|
def __eq__(self, other): |
| 835 |
|
return self is other or other is True or isinstance(other, _TRUE) |
| 836 |
|
|
| 837 |
|
def __str__(self): |
| 838 |
|
return '1' |
| 839 |
|
|
| 840 |
|
def __repr__(self): |
| 841 |
|
return 'TRUE' |
| 842 |
|
|
| 843 |
|
def __call__(self): |
| 844 |
|
return self |
| 845 |
|
|
| 846 |
|
__nonzero__ = __bool__ = lambda s: True |
| 847 |
|
|
| 848 |
|
|
| 849 |
|
class _FALSE(BaseElement): |