Currently a set of functions returns success=True
or False
.
We've discovered this isn't good enough, though, since False
can convey both "valid result" or "invalid result", and we want behavior to differ in each case.
So I think they should be changed to instead return {True, False, InvalidResult}
, where bool(InvalidResult)
is false for backward compatibility, but can be tested for using if is InvalidResult
.
I'm not sure what the terminology is, but I'm imagining something like the built-in NotImplemented
that's returned by comparison functions. This is called a "special value" in the docs and is of type NotImplementedType
.
How to create such an object and what methods/attributes should it have? I should create my own type like NotImplementedType
also, or is there an existing type that conveys this "flag" concept? It's a similar kind of object to True
, False
, None
, NotImplemented
, etc.