[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

Ethan Furman report at bugs.python.org
Fri Mar 20 15:09:21 EDT 2020


Ethan Furman <ethan at stoneleaf.us> added the comment:

Immediate solution is to raise an exception if `_generate_next_value_` is defined after members.

Possible future solution is to save all member definitions until after class is defined.

The exception-raising solution would require a check in `_EnumDict` where `_generate_next_value_` is saved -- if any members already exist, raise.

----------
assignee: docs at python -> ethan.furman
keywords: +easy
stage:  -> needs patch
versions: +Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40025>
_______________________________________


More information about the Python-bugs-list mailing list