In this problem, I'm dealing with IPv6 network address spaces, so the length is 2^(128-subnet)
.
It appears that python (at least on this machine), will cope with up to a 64 bit signed number as the return value from __len__()
. So len(IP('2001::/66'))
works, but len(IP('2001::/65'))
fails.
from IPy import IP
len(IP('2001::/64'))
Traceback (most recent call last):
File "test.py", line 2, in <module>
len(IP('2001::/64'))
OverflowError: long int too large to convert to int
The IPy library in question is at https://github.com/haypo/python-ipy.
Any suggestions on how to handle this, or hint that it might be a limitation I'm stuck with?