<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#330033" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 4/25/2013 3:23 PM, Barry Warsaw
wrote:<br>
</div>
<blockquote cite="mid:20130425182310.1dc455ba@anarchist" type="cite">
<pre wrap="">My point is, "days of the week" has a natural ordering, so why wouldn't you
use IntEnum for that? Problem solved.</pre>
</blockquote>
<br>
While the ordering is natural, some implementations start from 0,
some start from 1, and on the naming side, some start from Sunday,
and some start from Monday. So there are lots of opportunities for
the numbers vary, and having easy conversions to int which expose
those numbers and allow comparisons to integers, is adding problems,
not solving them.<br>
<br>
<br>
<div class="moz-cite-prefix">On 4/25/2013 3:36 PM, Ethan Furman
wrote:<br>
</div>
<blockquote cite="mid:5179B005.2030601@stoneleaf.us" type="cite">People
like things sorted (or am I alone here?) There are three obvious
natural orderings: <br>
<br>
1 - value <br>
<br>
2 - definition order <br>
<br>
3 - name <br>
<br>
And that's my order of preference for them.
</blockquote>
<br>
So, being blissfully unaware of the implementation issues, not
having yet read the implementation, I suggest that the preferred
iteration order should be a characteristic of the Enum when defined,
and/or that there should be a method to obtain a list in any of the
natural orderings (specifying value ordering may add a restriction
that the values be orderable, if done at definition time; if done
only on retrieval, attempting to access the list by value would
raise an exception).<br>
<br>
Another possible ordering would be "random", and for enumerations
with values that are tuples or lists or hashes, ordering by some
specified element would be conceivable. On the other hand, except
for "definition" order, all the other possible orderings could be
derived externally to the enumeration.<br>
<br>
So if enumerations preserve/provide "definition" order, all the
others could be implemented externally or as subtypes. "Definition"
order, then is the basic ordering for enumerations because it cannot
be externally derived, other than by reading the source code.<br>
<br>
</body>
</html>