[Python-Dev] Enum conversions in the stdlib
Ethan Furman
ethan at stoneleaf.us
Thu Mar 2 19:13:17 EST 2017
There are a few modules that have had their constants redefined as Enums, such as signal, which has revealed a minor nit:
>>> pp(list(signal.Signals))
[<Signals.SIGUSR2: 12>,
<Signals.SIGINT: 2>,
<Signals.SIGTTIN: 21>,
<Signals.SIGFPE: 8>,
<Signals.SIGRTMAX: 64>,
<Signals.SIGABRT: 6>,
<Signals.SIGCONT: 18>,
<Signals.SIGBUS: 7>,
<Signals.SIGHUP: 1>,
<Signals.SIGTSTP: 20>,
<Signals.SIGSEGV: 11>,
<Signals.SIGWINCH: 28>,
<Signals.SIGIO: 29>,
<Signals.SIGQUIT: 3>,
<Signals.SIGTRAP: 5>,
<Signals.SIGRTMIN: 34>,
<Signals.SIGPIPE: 13>,
<Signals.SIGVTALRM: 26>,
<Signals.SIGURG: 23>,
<Signals.SIGPROF: 27>,
<Signals.SIGCHLD: 17>,
<Signals.SIGXCPU: 24>,
<Signals.SIGILL: 4>,
<Signals.SIGSYS: 31>,
<Signals.SIGSTOP: 19>,
<Signals.SIGALRM: 14>,
<Signals.SIGPWR: 30>,
<Signals.SIGTERM: 15>,
<Signals.SIGTTOU: 22>,
<Signals.SIGXFSZ: 25>,
<Signals.SIGUSR1: 10>,
<Signals.SIGKILL: 9>]
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?
--
~Ethan~
More information about the Python-Dev
mailing list