5 ms·
I never got python's lack of built in enum syntax. I get not wanting to add unnecessary keywords, but unless you're doing something like Scheme or Smalltalk whe
by overgard 14y ago
I never got python's lack of built in enum syntax. I get not wanting to add unnecessary keywords, but unless you're doing something like Scheme or Smalltalk where you're going for almost no syntax at all, you would think it would pay off to put in keywords for things that literally occur in every program. I feel like I should just be able to write this:
enum Color: red, green, blue
Right now enumerations are a mess. It seems like every project does them slightly differently, and the new enum library just adds a new way to do them slightly differently. That's like the opposite of PEP 8.
- kemayo 14y agoWell, any new enum syntax would be "a new way to do them slightly differently". This one just has the advantage of being in the standard library, and thus is presumably what new usage will gravitate towards.
- j-kidd 14y agoIf we go with your way, then we would have problem like this: http://stackoverflow.com/questions/630803/associating-enums-with-strings-in-c-sharp http://stackoverflow.com/questions/630803/associating-enums-... The new enum library does more without introducing new syntax, and I think that's a good thing.