Re: [Python-Dev] PEP 435 -- Adding an Enum type to the Python standard library

2013年4月12日 19:53:45 -0700

On 13/04/13 10:13, Glenn Linderman wrote:
can't define two names in the same enum to have the same value, per the PEP.
I think that's too strong a restriction. I would expect to be able to do this:
class Insect(Enum):
 wsap = 1 # Oops, needed for backward compatibility, do not remove.
 wasp = 1 # Preferred. Use this in new code.
 bee = 2
 ant = 3
Or at the very least:
class Insect(Enum):
 wasp = wsap = 1
 bee = 2
 ant = 3
I googled on "C enum" and the very first hit includes a duplicate value:
http://msdn.microsoft.com/en-AU/library/whbyts4t%28v=vs.80%29.aspx
And two examples from asm-generic/errno.h:
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EDEADLOCK EDEADLK
What's the justification for this restriction? I have looked in the PEP, and 
didn't see one.
--
Steven
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to