Should nested classes in an Enum be Enum members?
[Note: there is a similar thread on Python-Ideas, if you would like to respond there.]
Consider the following Enum definition:
RED = 1
GREEN = 2
BLUE = 3
return "I like %s eggs and spam!" % self.lower
Which of the above Color attributes are enums, and which aren't?
- RED, GREEN, and BLUE are members
- lower and spam() are not
- SomeClass /is/ a member (but not its instances)
Should `SomeClass` be an enum member? When would it be useful to have an embedded class in an Enum be an enum member?
The only example I have seen so far of nested classes in an Enum is when folks want to make an Enum of Enums, and the
nested Enum should not itself be an enum member. Since the counter-example already works I haven't seen any requests
for it. ;)
So I'm asking the community: What real-world examples can you offer for either behavior? Cases where nested classes
should be enum members, and cases where nested classes should not be members.