changeset: 89582:b6271cbcc762 user: Peter Moody date: Tue Mar 11 09:55:46 2014 -0700 files: Lib/ipaddress.py Misc/NEWS description: Issue #19157: Include the broadcast address in the usuable hosts for IPv6 in ipaddress. diff -r 16384988a526 -r b6271cbcc762 Lib/ipaddress.py --- a/Lib/ipaddress.py Tue Mar 11 13:17:30 2014 +0100 +++ b/Lib/ipaddress.py Tue Mar 11 09:55:46 2014 -0700 @@ -2155,6 +2155,18 @@ if self._prefixlen == (self._max_prefixlen - 1): self.hosts = self.__iter__ + def hosts(self): + """Generate Iterator over usable hosts in a network. + + This is like __iter__ except it doesn't return the + Subnet-Router anycast address. + + """ + network = int(self.network_address) + broadcast = int(self.broadcast_address) + for x in range(network + 1, broadcast + 1): + yield self._address_class(x) + @property def is_site_local(self): """Test if the address is reserved for site-local. diff -r 16384988a526 -r b6271cbcc762 Misc/NEWS --- a/Misc/NEWS Tue Mar 11 13:17:30 2014 +0100 +++ b/Misc/NEWS Tue Mar 11 09:55:46 2014 -0700 @@ -20,6 +20,9 @@ Library ------- +- Issue #19157: Include the broadcast address in the usuable hosts for IPv6 + in ipaddress. + - Issue #20875: Prevent possible gzip "'read' is not defined" NameError. Patch by Claudiu Popa.