Raise exception when not using correct boolean operators

This commit is contained in:
Yann Sionneau 2014-10-27 12:41:17 +01:00 committed by Sebastien Bourdeauducq
parent 86abb253c8
commit 286092b62e

View file

@ -24,6 +24,9 @@ class Value(HUID):
Values created from integers have the minimum bit width to necessary to Values created from integers have the minimum bit width to necessary to
represent the integer. represent the integer.
""" """
def __bool__(self):
raise NotImplementedError("For boolean operations between expressions: use '&'/'|' instead of 'and'/'or'")
def __invert__(self): def __invert__(self):
return _Operator("~", [self]) return _Operator("~", [self])
def __neg__(self): def __neg__(self):