[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

Ethan Furman ethan at stoneleaf.us
Sat Feb 23 19:07:12 CET 2013


On 02/23/2013 09:46 AM, Nick Coghlan wrote:
> Many other existing libraries would be in the same boat - backwards
> compatibility would be an insurmountable barrier to using enums, but
> they *could* use named values.

I like the idea of named values, but to be clear about enums:  if they are int-based (like
True and False are) and don't mess with the math operations (like True and False don't) then
we could use them with impunity:

   True + False = 1
   os.SEEK_CUR * 3 = 3 (assuming, of course, that os.SEEK_CUR == 1)

--
~Ethan~

P.S.  Has the irrevokable decision been made that enums will *not* be int based?  If so, I'll
stop bringing up this point -- I'm starting to bore myself with it.


More information about the Python-Dev mailing list