|fuzzybool fuzzybool " ={ % ={ %}format(ab returnsfuzzybool( is nowfuzzybool( returns' = = %we want the fuzzybool type to support the complete set of comparison operators (=>)and the three basic logical operationsnot (~)and (&)and or (|in addition to the logical operations we want to provide couple of other logical methodsconjunction(and disjunction()that take as many fuzzybools as we like and return the appropriate resultant fuzzybool and to complete the data type we want to provide conversions to types boolintfloatand strand have an eval()-able representational form the final requirements are that fuzzybool supports str format(format specificationsthat fuzzybools can be used as dictionary keys or as members of setsand that fuzzybools are immutable--but with the provision of augmented assignment operators (&and |=to ensure that they are convenient to use table ( lists the comparison special methodstable lists the fundamental special methodsand table lists the numeric special methods--these include the bitwise operators (~&and |which fuzzybools use for their logical operatorsand also arithmetic operators such as and which fuzzybool does not implement because they are inappropriate creating data types from scratch to create the fuzzybool type from scratch means that we must provide an attribute to hold the fuzzybool' value and all the methods that we require here are the class line and the initializertaken from fuzzybool pyclass fuzzybooldef __init__(selfvalue= )self __value value if <value < else shapealt circle radius property we have made the value attribute private because we want fuzzybool to behave like immutablesso allowing access to the attribute would be wrong alsoif an out-of-range value is given we force it to take fail-safe value of (falsein the previous subsection' shapealt circle class we used stricter policyraising an exception if an invalid radius value was used when creating new circle object the fuzzybool' inheritance tree is shown in figure the simplest logical operator is logical notfor which we have coopted the bitwise inversion operator (~)def __invert__(self)return fuzzybool( self __value