[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as (original) (raw)
Eli Bendersky eliben at gmail.com
Mon Feb 25 15:45:27 CET 2013
- Previous message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Next message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2) When you do, wrapping the item in int() doesn't seem too bad to me.
If it was just once or twice, sure, but I use them as names for ints, which means I use them as ints, which means I would have a boat load of int() calls.
Personally I don't see "name for ints" as being the main use case for enums. For preparing the draft PEP I ran through some stdlib, Twisted and personal code and there are tons of places that just need a simple enum for some sort of "state", meaningful return value, or similar. That's really where you need enums the most, and really where their values don't matter.
I prefer to have a good solution to one problem than a poorer solution that tries to cover two unrelated problems. For "names for ints", Nick's named value proposal seems more relevant, but why mix the two together?
Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130225/c1df0bb9/attachment.html>
- Previous message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Next message: [Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]