Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the meaning of the following code? #8

Closed
exhuma opened this issue Feb 28, 2014 · 1 comment
Closed

What's the meaning of the following code? #8

exhuma opened this issue Feb 28, 2014 · 1 comment

Comments

@exhuma
Copy link

exhuma commented Feb 28, 2014

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?

@phihag
Copy link
Owner

phihag commented Jun 23, 2014

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.

@phihag phihag closed this as completed Jun 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants