<div dir="ltr">On 26 February 2013 07:32, Barry Warsaw <span dir="ltr"><<a href="mailto:barry@python.org" target="_blank">barry@python.org</a>></span> wrote: <div class="gmail_extra"><div class="gmail_quote"><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">

One thing I've been thinking about is allowing you to override the EnumValue<br>
class that the metaclass uses.  In that case, if you really wanted ordered<br>
comparisons, you could override __lt__() and friends in a custom enum-value<br>
class.  I haven't quite worked out in my mind how that would look, but I have<br>
a bug to track the feature request:<br>
<br>
<a href="https://bugs.launchpad.net/flufl.enum/+bug/1132976" target="_blank">https://bugs.launchpad.net/flufl.enum/+bug/1132976</a><br>
<br>
Heck, that might even allow you to implement int-derived enum values if you<br>
really wanted them <wink>.<br></blockquote><div><br></div><div style>You're starting to tread in an area that I investigated, did an implementation of, and then started moving away from due to a different approach (delegating to the methods in the owning Enum class when accessing EnumValue attribtues).</div>
<div style><br></div><div style>I haven't touched my implementation for a couple of weeks now - been busy with other stuff and I got a bit fatigued with the discussion so I decided to wait until things had settled a bit. Hasn't happened yet ... ;)</div>
<div style><br></div><div style>I'm actually in a quandry about what way I want my enums to go. I think each enum should have an ordinal based on the order it is defined, and should be ordered by that ordinal. But (whether or not it inherits from int - I'm ignoring string enums here) should __int__ and __index__ return the ordinal, or the assigned int value (if it has one)? There are arguments both ways. My current implementation doesn't have an ordinal at all (except by accident in the trivial case). That was when I decided to put it aside for a while and see where the discussion went.</div>
<div style><br></div><div style>Tim Delaney </div></div></div></div>