[issue18720] Switch suitable constants in the socket module to IntEnum

Eli Bendersky report at bugs.python.org
Fri Aug 16 15:28:34 CEST 2013


Eli Bendersky added the comment:

Great catch, Charles-François, thanks. It's actually an interesting example in favor of the approach - it's very nice to see descriptive family names in the data returned by getaddrinfo, instead of obtuse numeric values.

The attached patch fixes it in a similar vein to what was done for the family accessor: getaddrinfo is overridden in Python and does the necessary conversion. User code is unaffected. It has to rebuild the list (since those are tuples) but I don't think it matters in terms of performance for this specific function. As a bonus, getaddrinfo got a much nicer docstring :)

----

Note again that if this is acceptable, I'm going to similarly convert SOCK_* and post a full patch (with some documentation too).

----------
Added file: http://bugs.python.org/file31313/socket-intenum-af.4.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18720>
_______________________________________


More information about the Python-bugs-list mailing list