This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Readd __index__ support on ipaddress objects
Type: Stage:
Components: Versions: Python 3.7, Python 3.6, Python 3.4, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, josh.r, ncoghlan, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-11-21 17:40 by josh.r, last changed 2022-04-11 14:58 by admin.

Messages (3)
msg281384 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2016-11-21 17:40
It looks like, due to #16722, in #15559, __index__ was removed from ipaddress objects. #16722 was fixed a few months later, but the comments asking for it to be readded were put on a closed issue, so no one noticed.

Can __index__ support be readded now? Should be as simple as undoing https://hg.python.org/cpython/rev/5abea8a43f19 (probably manually, assuming the subsequent history would make a direct rollback nonfeasible).

Nosying the folks involved in fixing the original bugs.
msg281385 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-21 17:53
Why __index__ support is needed?
msg289959 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2017-03-22 02:01
From the original bugs, it looks like people liked being able to directly produce the hex of the IP addresses using hex(). I'll admit I'm only +0.5 on restoring __index__; having them be equivalent to int, not just convertable, doesn't seem critical. I just noticed the original bugs (don't even remember why I found them) and figured the functionality should be restored, per the comments on those bugs.
History
Date User Action Args
2022-04-11 14:58:39adminsetgithub: 72953
2017-03-22 02:01:09josh.rsetmessages: + msg289959
2016-11-21 17:53:21serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg281385
2016-11-21 17:40:40josh.rcreate