[Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library (original) (raw)
Davis Silverman sinistersnare at gmail.com
Fri Apr 12 16:34:18 CEST 2013
- Previous message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Next message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
i agree with that, and good point, i guess i misunderstood.
enums could be a nice edition, i cant wait to see how this goes.
--Sinistersnare
On Fri, Apr 12, 2013 at 10:23 AM, R. David Murray <rdmurray at bitdance.com>wrote:
On Fri, 12 Apr 2013 10:19:29 -0400, Davis Silverman <_ _sinistersnare at gmail.com> wrote: > I think the reason they are not supporting lt, gt,etc. is because > ints are optional values for enums, therefore it wouldnt be a good idea to > compare enums of different types in that way. > > example: > > >>>class MyEnum(Enum): > >>> fir = 1 > >>> sec = 2 > >>> thir = "THIRD!" > > and doing > > >>> MyEnum.fir >= MyEnum.thir > would give unexpected results, therefore not making it a great idea
That's why I included the bit about iterating the values. The ordering is defined. I find it much more surprising for that ordering to be inaccessible via the comparison operators. I think either the iteration order should be undefined (like a set or dict), or the comparison operations should work. I'd prefer the latter, because of the use case I outlined. --David
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/sinistersnare%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130412/1d6a2f1f/attachment-0001.html>
- Previous message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Next message: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]