On 28/05/2021 04:24, Ethan Furman wrote:
The flags RED, GREEN, and BLUE are all canonical, while PURPLE and WHITE are aliases for certain flag combinations. But what if we have something like:
class Color(Flag): RED = 1 # 0001 BLUE = 4 # 0100 WHITE = 7 # 0111
So, like the enum.unique decorator that can be used when duplicate names should be an error, I'm adding a new decorator to verify that a Flag has no missing aliased values that can be used when the programmer thinks it's appropriate... but I have no idea what to call it.
The propery you are looking for IIUC is that if a bit position is 1 in any member, then there is a member with only that bit set. I am seeing these members as sets of elements (bit positions) and therefore you want optionally to ensure that your enumeration has a name for every singleton set, into which any member could be analysed.
Words like "basis", "complete", "analytic", or "indicator" (as in indicator function) come to mind. I find "singletonian" attractive, but no-one will know what it means, and I just made it up.