March 25, 2020
8:13 p.m.
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`.