<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 22, 2013 at 10:41 PM, Zero Piraeus <span dir="ltr"><<a href="mailto:z@etiol.net" target="_blank">z@etiol.net</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">
<div id=":1a6" style="overflow:hidden">I may be misunderstanding the use case given in the issue,</div></blockquote><div><br></div><div>To clarify the use case, since it is my bug, this is so that the enum values are always available for comparison. The exact use case is in Django templates where a value comes from the database. If you want to compare you either have to use __class__ which I would say is a code smell, or you have to provide the Enum class. The code we are using for this is open source <a href="http://github.com/tindie/django-tidyenum">http://github.com/tindie/django-tidyenum</a>. An example of how this will be used in practice is:</div>
<div><br></div><div>    {% if object.state == object.state.completed %}</div><div>      some html</div><div>    {% endif %}</div><div> </div><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">
<div id=":1a6" style="overflow:hidden"> but it seems<br>
to me that having to use<br>
<br>
    Color.red.__class__.blue<br>
<br>
(what is being complained about in the issue), while not exactly pretty,<br>
makes a lot more semantic sense than<br>
<br>
    Color.red.blue<br>
<br>
... which is just bizarre.</div></blockquote></div><br>Any more bizarre than any other class that has properties of it's own type?</div><div class="gmail_extra"><br></div><div class="gmail_extra">      a = 0</div><div class="gmail_extra">
      a.real.numerator.real.numerator<br><br clear="all"><div>It is only weird because we are not used to seeing classes where the properties are instances of the class. I am not a core developer, but I have been programming in Python for more than 10 years, and I (and the other similarly experienced developers I work with) found that not having access to the class level properties was weird (yes I am aware that they are not actually class level properties but everywhere else Enum works hard to make it look like they are. See for instance the __dir__ method: <a href="http://hg.python.org/cpython/file/ed011b0d7daf/Lib/enum.py#l242">http://hg.python.org/cpython/file/ed011b0d7daf/Lib/enum.py#l242</a>).</div>
<div><br></div><div>-Chris</div><div><br></div>-- <br>Christopher Lambacher<br><a href="mailto:chris@kateandchris.net">chris@kateandchris.net</a>
</div></div>