<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 13 February 2013 08:59, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
And I'm of the opinion that the most fundamental property of an enum<br>
is that it doesn't print as an int.</blockquote><div><br></div><div style>That part is easy.</div><div style><br></div><div style><div>Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32</div>
<div>Type "help", "copyright", "credits" or "license" for more information.</div><div>>>> from enum import Enum</div><div>>>> class Color(Enum):</div><div>...     RED</div>
<div>...</div><div>>>> str(Color.RED)</div><div>'Color.RED'</div><div>>>> repr(Color.RED)</div><div>"<EnumValue 'Color.RED': 0>"</div></div><div style><div>>>> str(Color)</div>
<div>'{RED:0}'</div><div>>>> repr(Color)</div><div>"<enum __main__.Color {<EnumValue 'RED': 0>}>"</div><div><br></div></div><div style>Making an appropriate str/repr just requires deciding what it should be. I chose to make the reprs give more information, but there's no reason they couldn't be simplified.</div>
<div style><br></div><div style>I'll see if I can come up with a syntax for declaration that we're both happy with, but I doubt I'll be as happy with it as what I've currently got (despite its edge cases).</div>
<div style><br></div><div style>Tim Delaney </div></div></div></div>