On Thu, 24 Jun 2021, 12:58 pm Ethan Furman, <et...@stoneleaf.us> wrote:
> TL;DR I am considering changing IntEnum and IntFlag's `__str__` to be > `int.__str__` > > IntEnum and IntFlag are becoming more common in the stdlib. They > currently show up in > > * http > * re > * signal > * ssl > * socket > > to name just a few. > > 3.10 already has some changes to the str() and repr() of enums in general: > > HTTPStatus -> OK and HTTPStatus.OK instead of HTTPStatus.OK and > <HTTPStatus.OK: 200> > That's already a major loss in enum repr() usability - the whole point of having both forms in the output was so that repr() gave you both the symbolic name and the raw number, allowing them to be looked up in external systems without needing access to the original enum definition to translate between forms. For the other proposal, I think you're stuck from a backwards compatibility point of view - the default needs to be the current behaviour, with some way to opt out of using the symbolic str representation. Cheers, Nick. >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/HXE3XTMYKSGDTV53AQ5TKDI5F5IOAS72/ Code of Conduct: http://python.org/psf/codeofconduct/