On 03/12/2013 06:03 PM, Random832 wrote:
effectively multi-enum sets Speaking of sets... it seems like sets of single enum values would be a good way to represent "ORed-together enums". But
On 03/12/2013 06:17 PM, Alex Stewart wrote: then if you want a function to accept one, it has to be able to not care if it's only a single one or not.
So, what if each value of a 'flags' type enum is also able to be treated as a single-member set of itself?
In aenum.py you are able to iterate over a BitMask enum, both single ones and ORed together ones, even if it only has one value. The code looks like this: 8<---------------------------------------------------------------------- def __iter__(yo): enums = [] for enum in yo._enums: if int(enum) & int(yo): enums.append(enum) return iter(enums) 8<---------------------------------------------------------------------- -- ~Ethan~