<div dir="ltr">Hi,<br><br>I made a fast implementation (I'm sure that can be done better) but it works (for what I understood).<br><br>Is tested in Python3.4, if you will execute in Python 2.x, or don't have mypy or don't like it, you always can remove the function annotations :)<br>

<br><a href="http://gist.github.com/rockneurotiko/017044d907242c2e0482">http://gist.github.com/rockneurotiko/017044d907242c2e0482</a><br><br>There are all the code and some own-tests :)<br><br>I hope that this is what you was asking for :)<br>

<br>Cheers!<br><br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-08-19 18:22 GMT+02:00 Peter Pearson <span dir="ltr"><<a href="mailto:ppearson@nowhere.invalid" target="_blank">ppearson@nowhere.invalid</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Tue, 19 Aug 2014 05:54:24 -0700 (PDT), Jurgens de Bruin wrote:<br>
><br>
> I do hope somebody can help me with the following:<br>
> I have the followings lists which represent the upper and lower value<br>
> of a range/array.<br>
><br>
> a = [1,50]<br>
> b = [75,150]<br>
> c = [25,42]<br>
> d = [120,149]<br>
> e = [35,55]<br>
><br>
> What I would like to happen is that overlapping range will "collapse"<br>
> to a single range meaning the above list would become:<br>
><br>
> as list a,c and e overlap they can be represented by<br>
> f = [1,55]<br>
> as list b and d overlap they can be represented by<br>
> g = [75,150]<br>
<br>
</div>Is your question about (a) identifying overlapping subsets of ranges,<br>
or (b) collapsing such subsets once you have identified them?<br>
<br>
What output would you want if the inputs were . . .<br>
<br>
a = [1,50]<br>
b = [2,10]<br>
c = [40,60]<br>
<br>
?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
To email me, substitute nowhere->spamcop, invalid->net.<br>
--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div style="text-align:center"><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,sans-serif;line-height:16px">Miguel García Lafuente - Rock Neurotiko</span></div>

<div style="text-align:center"><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,sans-serif;line-height:16px"><br></span></div><div style="text-align:center"><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,sans-serif;line-height:16px">Do it, the devil is in the details.</span></div>

<div style="text-align:center"><font color="#333333" face="Arial, Helvetica, sans-serif"><span style="line-height:16px">The quieter you are, the more you are able to hear.</span></font></div><div style="text-align:center">

<span style="font-family:Helvetica,arial,verdana;font-size:15px;line-height:22.5px;text-align:left">Happy Coding. Code with Passion, Decode with Patience.</span><font color="#333333" face="Arial, Helvetica, sans-serif"><span style="line-height:16px"><br>

</span></font></div><div style="text-align:center">If we make consistent effort, based on proper education, we can change the world.<span style="color:rgb(51,51,51);font-family:Arial,Helvetica,sans-serif;line-height:16px"></span></div>

<div style="text-align:center"><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,sans-serif;line-height:16px"><br></span></div><div style="text-align:center"><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,sans-serif;line-height:16px">El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a él.</span></div>

<div style="text-align:center"></div></div>
</div>