This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients David Hagen, John Hagen, abarry, barry, eli.bendersky, ethan.furman, python-dev, rhettinger, vstinner
Date 2016-08-18.15:23:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471533833.14.0.472088555784.issue26988@psf.upfronthosting.co.za>
In-reply-to
Content
Temporarily, marking this as open so that more people can see the new comments.

For John, I'm not sure what I can say that will help you.  The goal of the standard libraries modules is to provide tools the use language we have, not to invent a new language the isn't really Python or Pythonic.  In the absence of an "enum" keyword, you have a number of ways to work within the language.

In this case (wanting auto numbering but not caring what the values are), you already have several ways to do it.  I your issue is not where the use case is met; instead, you just don't like how their spelled (because it isn't exactly how it it looks in C).

This already works:  Animal = Enum('Animal', ['ant', 'bee', 'cat', 'dog']).  This is very flexible and lets you read the constants from many possible sources.

If you're attracted to multiline input, that is already possible as well:

    Animal = Enum('Animal', '''
	ant
	bee
	cat
	dog
    ''')

It is clear that you're bugged by writing Animal twice, but that is how Python normally works and it is a very minor nuisance (it only occurs once when the enum is defined).  Note, you already are rewriting "Animal" every time you use the enum value (presumably many times):  board_ark(Animal.ant, Animal.bee)

This whole feature request boils down to wanting a currently existing feature to be spelled a little differently, in a way that doesn't look like normal Python.  Elsewhere, we resisted the temptation to alter the language look-and-feel to accommodate small spelling tweaks for various modules (i.e. we pass in normal strings to the regex module even though that sometimes requires double escaping, we pass in the class name to namedtuples even though that uses the class name twice, the xpath notation in passed into XML tools as strings even though parts of it look like regular langauge, we don't abuse the | operator to link together chains of itertools, etc)

Since the enum module already provides one way to do it, I recommend that we stick with that one way.  Creating too many variants does not help users.  Using the core language in odd ways also does not help users.
History
Date User Action Args
2016-08-18 15:23:53rhettingersetrecipients: + rhettinger, barry, vstinner, eli.bendersky, ethan.furman, python-dev, abarry, John Hagen, David Hagen
2016-08-18 15:23:53rhettingersetmessageid: <1471533833.14.0.472088555784.issue26988@psf.upfronthosting.co.za>
2016-08-18 15:23:53rhettingerlinkissue26988 messages
2016-08-18 15:23:52rhettingercreate