There is a 'small' documentation issue in IPy.PY
d1b opened this issue · comments
David commented
There is a 'minor' documentation issue in IPy.PY
line:569 def __len__(self):
"""Return the length of a subnet.
Called to implement the built-in function len().
It breaks with IPv6 Networks. Anybody knows how to fix this."""
...
return int(self.len())
The reason that it breaks with ipv6 is that len() must return an integer. Calling int() before returning the result is not enough. I do not think it would be desirable to alter the current behaviour. Perhaps a note could be added to the documentation about the fact that len(IPy.IP(...) ) for ipv6 ranges may result in an exception being raised and that IPy.IP(..).len() should be used instead.
Jeff Ferland commented
Alright, looked into this and confirmed that it can't be fixed in code, so documentation it shall be.
Jeff Ferland commented
Fixed via documentation in 71a61cf