Performance problem with filtering
Sheila King
usenet at thinkspot.net
Wed Mar 13 23:39:54 EST 2002
On Thu, 14 Mar 2002 15:06:09 +1100, "Delaney, Timothy" <tdelaney at avaya.com>
wrote in comp.lang.python in article
<mailman.1016078842.13805.python-list at python.org>:
> Bah ...
>
> results = filter(lambda k: not c.has_key(k), b)
>
> That will slow it down a bit (using the lambda) but will give the right
> result ;)
How does something with list comprehensions compare? Like:
b = [entry for entry in b if entry not in a]
Is this as slow as the original method suggested? Or is it closer to
dictionary performance?
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/
More information about the Python-list
mailing list