On Mon, Sep 23, 2013 at 09:45:46AM -0400, Chris Lambacher wrote: > [...] 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.
I'm having a hard time seeing why the latter is problematic, I must admit (certainly no more so than the "Alice in Wonderland" side effects previously described). > [...] An example of how this will be used in practice is: > > {% if object.state == object.state.completed %} > some html > {% endif %} The names used slightly obscure the weirdness of it, but what you're really saying there is: if my_state == my_state.another_state ... which feels more like a code smell to me than {% if object.state == State.completed %} some html {% endif %} That's quite intelligible, and doesn't require anyone to know that an Enum member's siblings can, in your proposal, be accessed directly via dot notation (an unintuitive state of affairs, to me at least). -[]z. -- Zero Piraeus: omnia omnibus http://etiol.net/pubkey.asc _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com