On 26Mar2020 00:35, Serhiy Storchaka <[email protected]> wrote:
26.03.20 00:08, Cameron Simpson пише:
I think a more "Python normal" module might have multiple enum
classes, maybe with overlapping names.
Do you have any examples of more "Python normal" modules?
Unfortunately no because I am not yet using enums as much as I should.
We discuss here the behavior of the private method Enum._convert_()
used exclusively in the stdlib.
My concern is basicly that in normal Python usage, the names within a
class (and thus the names in an enum) are named to be distinct within
the class namespace. So I would not expect the names for particular
values to have extra qualification (eg I expect them to be like the
"RED" in my two class example - getting "module_name.RED" doesn't inform
the user about which class is in use, and since they might reasonably
have different concrete values like 4 versus 7 that seems unfortunate).
I agree that having the enums from the socket module just recite
"socket.AF_UNIX" would be nice. So if those enums overrode the
Enum._convert_() method I see no reason to object.
However, that only works because those names mirror the C library names,
which are already globally unique.
So my discomfort is present only if there were a general change
affecting all enums, rather than a socket-module-specific change
affecting just the enums from the socket module.
Cheers,
Cameron Simpson <[email protected]>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/HATTBNW4JA2EBGT745QQSANG2JKLVM7V/
Code of Conduct: http://python.org/psf/codeofconduct/