Removing dictionary-keys not in a set?

Aahz aahz at pythoncraft.com
Mon Apr 18 12:24:54 EDT 2005


In article <1113824946.525441.285760 at l41g2000cwc.googlegroups.com>,
Tim N. van der Leeuw <tim.leeuwvander at nl.unisys.com> wrote:
>
>I'd like to remove keys from a dictionary, which are not found in a
>specific set. So it's kind of an intersection-operation.

Why not just use the builtin set operations?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR



More information about the Python-list mailing list