On 14 February 2013 05:14, Barry Warsaw <barry@python.org> wrote:
On Feb 12, 2013, at 02:13 PM, Eli Bendersky wrote:

>I agree, and Tim's implementation provides a very nice string
>representation, no matter what the value underneath is. I don't really care
>what the value underneath is, actually.

Except that sometimes you do, which is why flufl.enum has a nice concise str
and a more detailed repr.  The former doesn't include the underlying value
while the latter does.  Edible cake.

Yes - my enum's exactly the same - simple, concise str (for both the enum and values) and detailed repr. The actual repr is a little different to flufl.enum repr (I think the str is the same) but conveys the same information.

Color.RED
<EnumValue 'Color.RED': 0>

{RED:0, GREEN:1, BLUE:2, CYAN:10, MAGENTA:11, YELLOW:12, BLACK:127}
<enum __main__.Color {<EnumValue 'RED': 0>, <EnumValue 'GREEN': 1>, <EnumValue 'BLUE': 2>, <EnumValue 'CYAN': 10>, <EnumValue 'MAGENTA': 11>, <EnumValue 'YELLOW': 12>, <EnumValue 'BLACK': 127>}>

Tim Delaney