[New-bugs-announce] [issue40066] Enum._convert should change __repr__ and/or __str__ to use module name instead of class name

Ethan Furman report at bugs.python.org
Wed Mar 25 15:48:58 EDT 2020


New submission from Ethan Furman <ethan at stoneleaf.us>:

Serhiy had the idea of having Enum._convert also modify the __str__ and __repr__ of newly created enumerations to display the module name instead of the enumeration name (https://bugs.python.org/msg325007):

--> socket.AF_UNIX
<AddressFamily.AF_UNIX: 1>   ==>  <socket.AF_UNIX: 1>

--> print(socket.AF_UNIX)
AddressFamily.AF_UNIX        ==>  socket.AF_UNIX

Thoughts?

----------
assignee: ethan.furman
messages: 365019
nosy: barry, eli.bendersky, ethan.furman
priority: normal
severity: normal
status: open
title: Enum._convert should change __repr__ and/or __str__ to use module name instead of class name
type: enhancement
versions: Python 3.9

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


More information about the New-bugs-announce mailing list