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.

Author Lord Anton Hvornum
Recipients Lord Anton Hvornum
Date 2017-09-26.19:00:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506452401.6.0.00951882046109.issue31597@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Network.hosts

I couldn't find anywhere in the documentation mentioning the fact that doing the following would return nothing:

>>> import ipaddress
>>> net = ipaddress.ip_network('127.0.0.1/32')
>>> list(net.hosts())
[]

For all intense and purposes, that network still contains hosts.
That being one single lonely host of '127.0.0.1'.

It's illogical to not return any hosts if there actually are one or more in there.
Now the programmer has to do a one-off-check to see if this particular defined network (of a huge list usually)
happens to end with /32, then it needs to treat the item not as a defined network (even tho it is with a netmask),
but rather strip the netmask and treat it as a single host entity.. It makes no sense if you're iterating over a huge list of network infrastructure.
History
Date User Action Args
2017-09-26 19:00:01Lord Anton Hvornumsetrecipients: + Lord Anton Hvornum
2017-09-26 19:00:01Lord Anton Hvornumsetmessageid: <1506452401.6.0.00951882046109.issue31597@psf.upfronthosting.co.za>
2017-09-26 19:00:01Lord Anton Hvornumlinkissue31597 messages
2017-09-26 19:00:01Lord Anton Hvornumcreate