On 26Mar2020 00:35, Serhiy Storchaka <storch...@gmail.com> 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.

Cameron Simpson <c...@cskk.id.au>
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
Message archived at 
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to