Closed GoogleCodeExporter closed 9 years ago
I see this plays havoc with single hosts (/32)...
>>> ipnet = ipaddr.IPNetwork('192.168.1.2')
>>> len([a for a in ipnet.iterhosts()])
0
>>> int(ipnet.broadcast)-int(ipnet.network)+1
1
>>> int(ipnet.broadcast)-int(ipnet.network)-1
-1
Original comment by gr...@jingojango.net
on 27 Oct 2011 at 7:45
There's a difference, albeit somewhat of a subtle one, between numhosts and
iterhosts. numhosts returns the number of possible addresses on a given network
while iterhosts returns usable addresses (eg, - network and broadcast).
I could probably fix the method names to make the distinction a little clearer.
Original comment by pmo...@google.com
on 24 Nov 2011 at 9:32
Original issue reported on code.google.com by
gr...@jingojango.net
on 27 Oct 2011 at 7:35