Re:Python's sad, unimaginative Enum
by pjmlp on Saturday May 11, 2013 @06:18PM
(#5692313)
> > What would you expect a Pythonic enum to look like?
> >
> > class Colour(Enum):
> > red
> > green
>
> Hell no. I mean, even Go isn't that implicit, you still have to use the iota there.
No, Go just provides plain boring wannabe enums.
Pascal(1972), Modula-2(1978), Ada(1983), and many others:
type Color = (red, green)
ord(red) = 1, ord(green) = 2
len(Color) = 2
succ(red) = green
pred(green) = red
red < green
type colors = array [Color] of int;
No, Go just provides plain boring wannabe enums.
Pascal(1972), Modula-2(1978), Ada(1983), and many others: