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 veky
Recipients David Hagen, John Hagen, abarry, barry, eli.bendersky, ethan.furman, kennethreitz, python-dev, rhettinger, veky, vstinner
Date 2016-08-19.14:34:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471617253.23.0.460552470856.issue26988@psf.upfronthosting.co.za>
In-reply-to
Content
> For me, it's legit to use a singleton in an enum.

But you cannot explain _why_, right? Like Raymond says, it's not working like anything else in Python works.

To me, this looks almost the same as the gripes of those lazy people who want "myfile.close" expression to close myfile, or worse, "quit" to exit the Python interpreter. An irrational phobia of parentheses. Why not call your object, if you expect some code to be executed? [At least a dotted name like myfile.close _could_ be made to work using descriptors, but still I think everyone agrees it's not a good idea.]

To me, we either want to stay with default type metaclass (`style='imperative'`:), and write something like

    class Color(Enum):
        green = member()
        yellow = member()

or we acknowledge that `style='declarative'` has its place under the sun (not only for Enums, of course... database models, namedtuples, even ABCs could profit from it), and embrace its full power, realizing it's not Python we usually see, but it's still Python.

Magic is not something to be afraid of, if you understand it. We are talking Py3.6 here... aren't formatted strings a totally insane magic? Yet they ended up in the language, because they are immensely better than the alternatives. Here the gain is much smaller, but the threshold is much lower too: we don't need new syntax at all.
History
Date User Action Args
2016-08-19 14:34:13vekysetrecipients: + veky, barry, rhettinger, vstinner, eli.bendersky, ethan.furman, python-dev, abarry, John Hagen, David Hagen, kennethreitz
2016-08-19 14:34:13vekysetmessageid: <1471617253.23.0.460552470856.issue26988@psf.upfronthosting.co.za>
2016-08-19 14:34:13vekylinkissue26988 messages
2016-08-19 14:34:12vekycreate