Most efficient solution?

Alexandre Fayolle alf at leo.logilab.fr
Mon Jul 16 13:08:14 EDT 2001


On 16 Jul 2001 11:55:41 -0400, Alex <new_name at mit.edu> wrote:
>
>> I'm pretty sure this will work, though I've not tested. C.get(item)
>> will return None (thus false) if item was not in B, and 1 (thus true)
>> if item was in B. You should definitely give a try to this version.
>
>Yes, but what if item == None, or item == ''?

What we are looking at is the value associated to item in the dictionnary.
We set them explicitly to 1 for everything that's in B previously. get()
will return None if there is no matching key in the dictionnary.

Alexandre Fayolle
-- 
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Narval, the first software agent available as free software (GPL).



More information about the Python-list mailing list