-
Notifications
You must be signed in to change notification settings - Fork 42
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
Set difference of two IpNetwork
s
#125
Comments
Yes, this is definitely something that is useful for the broader community. PR is welcome, thanks! |
Great, thanks! I haven't opened a PR yet because I'm not sure how to proceed. The initial implementation I had was very close to this one, except it didn't actually implement The idea for this implementation was to reduce the repeated code at the cost of more abstractions and boilerplate code. The goal was to keep the actual operation in one location, so that it's easier to review and to make changes in the future. However, it has the major downside of actually exporting those new abstractions :/ Another solution would be to simplify it by removing the abstractions and simply copying the code. It's duplicated, but it does become simpler. Let me know which solution you'd prefer, and I can open a PR to start discussing any changes that should be made :) |
Sorry for sending out a large code dump 😅 Would it be okay if I opened a PR using the second solution, which should be simpler? |
Sorry for being late @jvff and thanks for your work on this. I feel like the second option is more readable and maintainable than the first one. Let me know if you agree. Please feel free to open a PR if you have time to get to it. |
No worries! Thanks for your time on this :) I've opened a PR (#126) with the implementation. Should this issue be closed and the discussion and review continue there? |
You may be interested in "Radix" trees. https://github.com/deepfield/py-radix/blob/master/radix.c https://github.com/ibmandura/ArtTree I am looking to use them with IP prefixes, and the status quo is an old C library from 20 years ago. (seriously there are go, perl, ruby, python bindings for this little BSD-4-Clause licensed library). |
We had a need to calculate the set difference between two
IpNetwork
s. So given an initial broadIpNetwork
, we wanted to remove a smallerIpNetwork
sub-network from it. The operation returned an iterator over the resulting set ofIpNetwork
s.We have code for this implemented, but we were wondering if this feature is something that would be worthwhile upstreaming. Should I open a PR with the code?
The text was updated successfully, but these errors were encountered: