iis: comparsion of two lists

Alex Martelli aleax at aleax.it
Sat Apr 27 02:51:21 EDT 2002


Matej Cepl wrote:

> On Fri, Apr 26, 2002 at 10:49:24PM +0000, Matej Cepl wrote:
> 
>>    erase = ()
>>    for msg in proc_old:
>>    if not(msg in loc_old):
>>    erase.append(msg)
> 
> Oh, boy,
> 
> I an answer myself. Sorry, for that. Am I correct, that mere
> erase = ()
> erase = filter (lambda m: return not(m in loc_old), proc_old)
> 
> would fly?

It would, but the first assignment is useless and the approach
needlessly complicated IMHO.

erase = [ m for m in proc_old if m not in loc_old ]


Alex




More information about the Python-list mailing list