What's the meaning of the following code?
exhuma opened this issue · 1 comments
In the function to collapse addresses, you "split IP addresses and networks": https://github.com/phihag/ipaddress/blob/master/ipaddress.py#L394
I don't quite understand why this is done? The function docs mention nothing about passing ip-addresses into the function. Only networks. So this seems a bit redundant... no?
A bit later, you de-duplicate the data. But that is already covered by the merge process as well. No? Redundant again?
Sorry for the late reply, but here it is:
First of all, this project is a mirror of Python 3's ipaddress, so the code in question is copied straight from there.
Since the function name is collapse_addresses
and the first and only parameter is addresses
, you can pass in addresses and networks alike. In any case, we must check that the caller has not mixed IPv4 and IPv6 objects, and that's what this code does.