On Freitag 22 April 2011, Vlastimil Brom wrote:
> check whether all items of a given dictionary are
> present in a reference dictionary

I would not call this is_subdict. That name does not
clearly express that all keys need to have the same
value.

set(subdict.items()) <= set(reference.items())

should be equivalent to your code

if you only want to check for presence of all
keys in the reference dict:

set(subdict.keys()) <= set(reference.keys())

-- 
Wolfgang
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to