Decorator for creating enumeration?

Since PEP 557 "Data Classes"[1] and PEP 526 "Syntax for Variable Annotations"[2] are accepted and become part of the language. Is it worth writing a proposal about decorator-version for creating an enumeration? Something like: from enum import enum @enum(unique=True, int_=False, flag=False, ...): class Color: RED : auto GREEN: auto BLUE : auto Despite the fact that Functional API to create enums already exists, it seems to me that decorator-version will allow to unify these two relatively young residents of the standard library. In addition, the idea of "Not having to specify values for enums"[3], which at the time seemed to involve much magic in the implementation, becomes part of the language. Of course, PEP 526 unequivocally says that it does not allow one to annotate the types of variables when tuple unpacking is used. But in any case, I find the variant with the decorator to be an interersting idea. With kind regards, -gdg [1] PEP 557 "Data Classes" <https://www.python.org/dev/peps/pep-0557/> [2] PEP 526 "Syntax for Variable Annotations" <https://www.python.org/dev/peps/pep-0526/> [3] Not having to specify values for enums. <https://www.python.org/dev/peps/pep-0435/#not-having-to-specify-values-for-e...>

There's a third-party enum package. Maybe you can contribute an implementation of this idea there. If it becomes popular maybe we can add it to the stdlib enum module. On Sun, Dec 10, 2017 at 2:23 AM, Kirill Balunov <kirillbalunov@gmail.com> wrote:
-- --Guido van Rossum (python.org/~guido)

On 12/10/2017 09:50 AM, Guido van Rossum wrote:
There's a third-party enum package. Maybe you can contribute an implementation of this idea there. If it becomes popular maybe we can add it to the stdlib enum module.
The third-party library in question is aenum (enum34 isn't getting new functionality). It can be found at https://bitbucket.org/stoneleaf/aenum . -- ~Ethan~

There's a third-party enum package. Maybe you can contribute an implementation of this idea there. If it becomes popular maybe we can add it to the stdlib enum module. On Sun, Dec 10, 2017 at 2:23 AM, Kirill Balunov <kirillbalunov@gmail.com> wrote:
-- --Guido van Rossum (python.org/~guido)

On 12/10/2017 09:50 AM, Guido van Rossum wrote:
There's a third-party enum package. Maybe you can contribute an implementation of this idea there. If it becomes popular maybe we can add it to the stdlib enum module.
The third-party library in question is aenum (enum34 isn't getting new functionality). It can be found at https://bitbucket.org/stoneleaf/aenum . -- ~Ethan~
participants (3)
-
Ethan Furman
-
Guido van Rossum
-
Kirill Balunov