New submission from Antony Lee <anntzer....@gmail.com>:

Currently, enum.auto doesn't work with the new (Py3.10) StrEnum: `class 
E(enum.StrEnum): a = enum.auto()` results in `TypeError: 1 is not a string`.

I would guess that the most reasonable behavior for auto() in a StrEnum would 
be to return the name itself, as implemented in the AutoName example at 
https://docs.python.org/3.10/library/enum.html#using-automatic-values.  I 
believe that this may just be a matter of copying the corresponding 
`_generate_next_value_` implementation into the definition of StrEnum?

----------
components: Library (Lib)
messages: 381220
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Should enum.auto's behavior be adjusted for StrEnum to return the enum 
name?
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42385>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to