What is most pythonic way to convert a set of integers into ranges (there is question about that already converting a list of integers into range in python) BUT with some sort of accepted margin?
Example, we have: 1, 2, 3, 4, 5, 10, 11, 15, 45, 46, 47, 75, 76, 80, 85
so normally we would get: {1,5}, {10, 11}, {15, 15}, {45, 47}, {75, 76}, {80, 80}, {85, 85}
but we want to allow margin of 20, so next range will be created only if the difference between previous item and next item is bigger than 20
As result we should get: {1, 15}, {45, 47}, {75, 85}