On Thu, May 27, 2021 at 8:30 PM Ethan Furman email@example.com wrote:
But what if we have something like:
class Color(Flag): RED = 1 # 0001 BLUE = 4 # 0100 WHITE = 7 # 0111
As you see, WHITE is an "alias" for a value that does not exist in the Flag (0010, or 2). That seems like it's probably an error.
Are there use cases where you want to support gaps in the bits? If not, your decorator could accept which flags should be spanned. That seems useful, too. It would be a strictly stronger check. That would change the kind of name you want, though.
Otherwise, some things that occur to me: factorable, factorizable, factorized, decomposable. The thinking here is that each named member should be capable of being decomposed / factored into individual values that themselves have names.