New submission from Ram Rachum:

I suggest making Enum members orderable, according to their order in the enum 
type. Currently trying to order them raises an exception:

    >>> import enum
    >>> class Number(enum.Enum):
    ...     one = 1
    ...     two = 2
    ...     three = 3
    >>> sorted((Number.one, Number.two))
    Traceback (most recent call last):
      File "<pyshell#2>", line 1, in <module>
        sorted((Number.one, Number.two))
    TypeError: unorderable types: Number() < Number()

If there's agreement from core developers that this is a good feature to add, 
I'll write a patch.

----------
components: Library (Lib)
messages: 227678
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Add ordering between `Enum` objects
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22504>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to