Author rhettinger
Recipients barry, eli.bendersky, ethan.furman, ezio.melotti, martin.panter, python-dev, r.david.murray, rhettinger, serhiy.storchaka, veky
Date 2016-09-07.20:01:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473278487.78.0.155604943047.issue23591@psf.upfronthosting.co.za>
In-reply-to
Content
> Any problems with:
> 
> class Color(Enum):  # or Color(Flag)
>  red = _auto_
>  green = _auto_
>  blue = _auto_

As long as _auto_ has been defined somewhere (i.e. from enum import _auto_), it is normal Python and doesn't fight with the rest of language or its toolchains.

The idea does seem to be at odds with the enum module itself.  Heretofore, the rule for the module is that if the same object is assigned to multiple variable names, those names become synonyms.

    >>> from enum import Enum
    >>> class Color(Enum):
	red = 1
	magenta = 1
	orange = 2
	ochre = 2

    >>> Color.orange is Color.ochre
    True

Also, I still question the need, you already have multiple ways to do it:

    Color = Enum('Color', ['red', 'green', 'blue'])

    Color = Enum('Color', '''
        red
        green
        blue
    ''')
History
Date User Action Args
2016-09-07 20:01:27rhettingersetrecipients: + rhettinger, barry, ezio.melotti, r.david.murray, eli.bendersky, ethan.furman, python-dev, martin.panter, serhiy.storchaka, veky
2016-09-07 20:01:27rhettingersetmessageid: <1473278487.78.0.155604943047.issue23591@psf.upfronthosting.co.za>
2016-09-07 20:01:27rhettingerlinkissue23591 messages
2016-09-07 20:01:27rhettingercreate