.broadcast() returns IPv4('0.0.0.2') for IPv6('::2/128')
https://github.com/autocracy/python-ipy/blob/b8eb507bf2e94e878e092b16746d2cd8a058294f/IPy.py#L821 missing IP version propagation as compared to https://github.com/autocracy/python-ipy/blob/b8eb507bf2e94e878e092b16746d2cd8a058294f/IPy.py#L811
Reproduce with:
import IPy; print(IPy.IP('::3/128').broadcast().version()) # 4
In general, I'd prefer to have .first_address() and .last_address() methods as IPv6 address has no "broadcast" part.
// random losses of edits observed //
So I should raise an error on .broadcast() when it's v6?
IPRange[0] and IPRange[-1] I think will provide you with first and last. I'll look later.
So I should raise an error on .broadcast() when it's v6?
I think, no. It will break lots of code. As a first mitigation I'd propose to pass the version info (like in .net() method).
Please, keep in mind that, for instance, https://github.com/irrdnet/irrd makes heavy use of .net()/.broadcast() (yepp, instead of ip[0]/ip[-1]) and is a production code (not mine :smile: )
I think you're generally right here. Patch encouraged, otherwise I'll code it up next time I get nudged to do a release for other reasons.