On 03/25/2020 12:54 PM, Ethan Furman wrote:
--> socket.AF_UNIX
<AddressFamily.AF_UNIX: 1> ==> <socket.AF_UNIX: 1>
--> print(socket.AF_UNIX)
AddressFamily.AF_UNIX ==> socket.AF_UNIX
An important point I should have included -- the definition of
AddressFamily:
IntEnum._convert_(
'AddressFamily',
__name__,
lambda C: C.isupper() and C.startswith('AF_')
)
That last line is filtering the globals from `__name__`* to make the
Enum -- in other words, the member names are already globally unique.
Every usage of `Enum._convert` is like that.
--
~Ethan~
* `__name__` is the module name, which is looked up in `sys.modules`.
_______________________________________________
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/HJBSDMG3DSEAVHNAUIGZTOXMC5BLVLNO/
Code of Conduct: http://python.org/psf/codeofconduct/