Message325020
Serhiy said:
-----------
> I think using more longer name in repr and/or str for *instances* of
> enum classes is not good idea. They are already verbose, and this
> will make them more verbose.
I'm okay with verbose reprs, as debugging is the primary feature for those (at least for me). I'm not okay with __str__ being other than what it is now (but see below).
Serhiy also said:
----------------
> Actually in some cases when enum instances are exposed as module
> globals, I would want to make them including the module name instead
> of the enum class name. For example:
>
> >>> import socket
> >>> socket.AF_UNIX
> <AddressFamily.AF_UNIX: 1>
> >>> print(socket.AF_UNIX)
> AddressFamily.AF_UNIX
>
> "socket.AF_UNIX" instead of "AddressFamily.AF_UNIX" would look better
> to me.
Since AddressFamily, and other stdlib converted constants, are created user `_convert`, I have no problem with that method also changing the __str__ to be `module.member' instead. |
|
| Date |
User |
Action |
Args |
| 2018-09-11 16:00:40 | ethan.furman | set | recipients:
+ ethan.furman, barry, doerwalter, eli.bendersky, serhiy.storchaka, enedil, orlnub123, danishprakash, underscore_asterisk |
| 2018-09-11 16:00:40 | ethan.furman | set | messageid: <1536681640.48.0.0269046726804.issue34443@psf.upfronthosting.co.za> |
| 2018-09-11 16:00:40 | ethan.furman | link | issue34443 messages |
| 2018-09-11 16:00:40 | ethan.furman | create | |
|