[Tutor] Simple way to compare Two lists

Jaggo jaggojaggo at yahoo.com
Fri Aug 10 11:54:44 CEST 2007


Hello!

I desperately need a simple way to compare whether any item of SmallList is in BigList.

My current way,

def IsAPartOfList(SmallList,BigList)
for item in SmallList:
    if item in BigList:
        return True
return False

Takes up waay too much time to process.
Can anyone think of any better way?

Usually, SmallList is generated using range(Long, Long+ ~300)
BigList is usually of a few hundreds of long numbers.
The long numbers themselves represent date in seconds-since-the-epoch time. (E.G: time.time() is now in seconds-since-the-epoch,
1186739653.4679999
at the time of writing.)

Thank you for your help,
Omer Tabach.
----------------
Now playing: Haggard - Requiem in D-Minor
posted with FoxyTunes    

       
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070810/2a2f7453/attachment.html 


More information about the Tutor mailing list