[Python-Dev] Enum conversions in the stdlib
Guyzmo
z+py+pydev at m0g.net
Fri Mar 3 05:35:58 EST 2017
On Thu, Mar 02, 2017 at 04:13:17PM -0800, Ethan Furman wrote:
> The resulting enumeration is neither in alpha nor value order. While this
> has no bearing on programmatic usage I would like these Enums to be ordered,
> preferably by value.
>
> Would anyone prefer lexicographical ordering, and if so, why?
I just tried on my system with python 3.6:
```
>>> pprint(list(signal.Signals))
[<Signals.SIGHUP: 1>,
<Signals.SIGINT: 2>,
<Signals.SIGQUIT: 3>,
<Signals.SIGILL: 4>,
<Signals.SIGTRAP: 5>,
<Signals.SIGABRT: 6>,
<Signals.SIGBUS: 7>,
<Signals.SIGFPE: 8>,
<Signals.SIGKILL: 9>,
<Signals.SIGUSR1: 10>,
<Signals.SIGSEGV: 11>,
<Signals.SIGUSR2: 12>,
<Signals.SIGPIPE: 13>,
<Signals.SIGALRM: 14>,
<Signals.SIGTERM: 15>,
<Signals.SIGCHLD: 17>,
<Signals.SIGCONT: 18>,
<Signals.SIGSTOP: 19>,
<Signals.SIGTSTP: 20>,
<Signals.SIGTTIN: 21>,
<Signals.SIGTTOU: 22>,
<Signals.SIGURG: 23>,
<Signals.SIGXCPU: 24>,
<Signals.SIGXFSZ: 25>,
<Signals.SIGVTALRM: 26>,
<Signals.SIGPROF: 27>,
<Signals.SIGWINCH: 28>,
<Signals.SIGIO: 29>,
<Signals.SIGPWR: 30>,
<Signals.SIGSYS: 31>,
<Signals.SIGRTMIN: 34>,
<Signals.SIGRTMAX: 64>]
```
so I'm not sure what the issue is, but #worksforme.
--
zmo
More information about the Python-Dev
mailing list