[Python-Dev] enum discussion: can someone please summarize open issues?

Glenn Linderman v+python at g.nevcal.com
Mon Apr 29 06:49:10 CEST 2013

On 4/28/2013 9:09 PM, Guido van Rossum wrote:
> (2a. We could also allow Color('red') is Color.red, but that could be
> confusing, and we can already do that with getattr(Color, 'red'), and
> bool('False') doesn't return False anyway, so let's not do that.)

Glad you made this pronouncement in this way, because otherwise there 
would be ambiguity in the case:

   class Color(Enum):
      red = 'white'
      white = 'blue'
      blue = 'red'

although that would no doubt drive the programmers batty anyway... but there may be instances where code is generated that could produce something ambiguous, even though this example is atrocious.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130428/03088070/attachment.html>

More information about the Python-Dev mailing list