[issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name
Vedran Čačić
report at bugs.python.org
Mon Sep 14 18:31:43 EDT 2020
Vedran Čačić <vedgar at gmail.com> added the comment:
If it's considered to be not too backwards-incompatible, I think it would be nice to have str different from repr. That way we can finetune what exactly we need. But we can already do almost exactly that with *int* instead of *str*, so it's not too compelling.
Much more important thing is the "repr as inverse of eval". Is there any way we can have that for our own enums (as a mixin or a decorator)?
@module_global(re)
class RegexFlag(Enum):
...
It would be fantastic. :-)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40066>
_______________________________________
More information about the Python-bugs-list
mailing list