News for hackers. Stuff that matters.
Re:Python Enums for Humans by stevek on Monday February 27, 2012 @05:53AM (#3638528)
Does nobody else find the repetition objectionable? e.g. NEW = ('N', 'New'), If your values have good names, you can easily deduce "Some Constant" from SOME_CONSTANT or vice-versa. While I'm at it, having abbreviations built-in seems iffy too.
Re:Python Enums for Humans by wuster on Monday February 27, 2012 @03:59PM (#3640618)
The apparent repetition is due to the triviality of the example. Imagine if you had to translate the display string or change the display name without renaming all of your code references to the constant.