Message 314900 - Python tracker (original) (raw)

Fully agree that Flag.contains must RETURN False or True; that's why I suggested it RAISES TypeError The exception was to be consistent with e.g. Flag.and, which by returning NotImplemented transfers to type(other).rand, and assuming rand cannot handle Flag and also returns NotImplemented, falls back to the interpreter raising TypeError. Also e.g. 1 in 'hello' raises TypeError. For Flag, I wouldn't strongly oppose to False for other being a different type. However, classes derived from Flag could face issues, e.g. class MyIntFlag (Flag, int): pass.