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:
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.
Python-Dev mailing list -- firstname.lastname@example.org
To unsubscribe send an email to email@example.com
Message archived at https://firstname.lastname@example.org/message/7VN5Z5FSN3CH33KKQELX63L7JW6WEB2L/
Code of Conduct: http://python.org/psf/codeofconduct/