>> What is the best way to in python to identify the list items that
>> overlap and the items that don't overlap with any other.
>>

>Is this usable?

>Assuming you transform your 3 tuples into a list of start-end 2 tuples and
sort them for lowest to highest, then

>lst=[(55,58,52),(20,22,18),(17,21,13),(60,63,57)]
>a=[ (l[2],l[1]) for l in lst ]
>a.sort()
>a=[(1,5),(4,9),(10,12),(11,15),(16,19)]

>i=[ (pair,a[a.index(pair)+1]) for pair in a[:-1] if
a[a.index(pair)+1][0]<pair[1]]
>i
>[((13, 21), (18, 22)), ((52, 58), (57, 63))]

>?

Ah.

I guess not. That attempt doesnt catch non adjacent ranges that also
overlap :/

Matt.


This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 
Do not print this message unless it is necessary,
consider the environment.

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.
N'imprimez ce message que si necessaire,
pensez a l'environnement.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to