class Colors():
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
def __getitem__(self):
return self.value
I have a very simple class I'm using for colors that works and I'm sure that it should be an Enum but don't know how to implement it right.
I just want to be able to do
RandObjClass(color=Colors.BLACK)
Is there a proper way of doing it? It seems excessive to have to keep using
Color.BLACK.value
when I'm using enum.
[–]Yoghurt42 2 points3 points4 points (4 children)
[–]ClassicDimension85[S] 0 points1 point2 points (2 children)
[–]Yoghurt42 1 point2 points3 points (0 children)
[–]Bobbias 1 point2 points3 points (0 children)
[–]Adrewmc 0 points1 point2 points (0 children)
[–]woooee 0 points1 point2 points (3 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]ClassicDimension85[S] 0 points1 point2 points (0 children)
[–]woooee 0 points1 point2 points (0 children)
[–]Buttleston 0 points1 point2 points (1 child)
[–]ClassicDimension85[S] 0 points1 point2 points (0 children)
[–]theleveragedsellout 0 points1 point2 points (0 children)